[英]Ignition Provider for azure ubuntu vm
I am trying to write a systemd service
file using ignition provider
of terraform
like below for ubuntu OS
我正在尝试使用 terraform 的
ignition provider
为terraform
ubuntu OS
编写一个systemd service
文件,如下所示
# 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
}
and in azurerm_linux_virtual_machine
i gave like below在
azurerm_linux_virtual_machine
中我给出如下
custom_data = data.ignition_config.example.rendered
I am getting an error like below我收到如下错误
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"}]}}
How can i create a systemd service
file using terraform
and also what am i missing with above config, will this ignition
work only with centos
?我如何使用
terraform
创建一个systemd service
文件以及我在上面的配置中缺少什么,这个ignition
只适用于centos
吗? Any help on this would be appreciated对此的任何帮助将不胜感激
For the error message, you could use base64encode function to apply Base64 encoding to a string.对于错误消息,您可以使用base64encode function 将 Base64 编码应用于字符串。
custom_data = base64encode(data.ignition_config.example.rendered)
I tried it with Azure VM image UbuntuServer 16.04-LTS我尝试使用 Azure VM 映像 UbuntuServer 16.04-LTS
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.