gpt4 book ai didi

azure - 适用于 azure ubuntu 虚拟机的 Ignition Provider

转载 作者:行者123 更新时间:2023-12-03 04:48:50 29 4
gpt4 key购买 nike

我正在尝试使用terraformignition提供程序编写一个systemd服务文件,如下所示ubuntu操作系统

# Systemd unit data resource containing the unit definition
data "ignition_systemd_unit" "example" {
name = "example.service"
content = "[Service]\nType=oneshot\nExecStart=/usr/bin/echo Hello World\n\n[Install]\nWantedBy=multi-user.target"
}

# Ingnition config include the previous defined systemd unit data resource
data "ignition_config" "example" {
systemd = [
data.ignition_systemd_unit.example.rendered,
]
}

# Create a CoreOS server using the Igntion config.
resource "aws_instance" "web" {
# ...

user_data = data.ignition_config.example.rendered
}

azurerm_linux_virtual_machine中我给出了如下

custom_data = data.ignition_config.example.rendered

我收到如下错误

Error: expected "custom_data" to be a base64 string, got {"ignition":{"config":{},"timeouts":{},"version":"2.1.0"},"networkd":{},"passwd":{},"storage":{},"systemd":{"units":[{"contents":"[Service]\nType=oneshot\nExecStart=/usr/bin/echo Hello World\n\n[Install]\nWantedBy=multi-user.target","enabled":true,"name":"example.service"}]}}

我如何使用terraform创建systemd服务文件,以及我在上面的配置中缺少什么,这个ignition仅适用于Centos?对此的任何帮助将不胜感激

最佳答案

对于错误消息,您可以使用 base64encode函数将 Base64 编码应用于字符串。

 custom_data = base64encode(data.ignition_config.example.rendered)

我尝试使用 Azure VM 镜像 UbuntuServer 16.04-LTS enter image description here

关于azure - 适用于 azure ubuntu 虚拟机的 Ignition Provider,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63699982/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com