azure ubuntu vm 的 Ignition Provider
Ignition Provider for azure ubuntu vm
我正在尝试使用 terraform
的 ignition provider
编写一个 systemd service
文件,如下所示 ubuntu OS
# 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 service
文件以及我在上面的配置中缺少什么,这个 ignition
只能与 centos
一起使用吗?如有任何帮助,我们将不胜感激
对于错误消息,您可以使用 base64encode 函数将 Base64 编码应用于字符串。
custom_data = base64encode(data.ignition_config.example.rendered)
我尝试使用 Azure VM 映像 UbuntuServer 16.04-LTS
我正在尝试使用 terraform
的 ignition provider
编写一个 systemd service
文件,如下所示 ubuntu OS
# 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 service
文件以及我在上面的配置中缺少什么,这个 ignition
只能与 centos
一起使用吗?如有任何帮助,我们将不胜感激
对于错误消息,您可以使用 base64encode 函数将 Base64 编码应用于字符串。
custom_data = base64encode(data.ignition_config.example.rendered)
我尝试使用 Azure VM 映像 UbuntuServer 16.04-LTS