Closed ubenmackin closed 3 years ago
Describe the bug I'm sure this is not a bug, and my issue, but wasn't sure how to best ask a question.
I'm trying to follow
https://github.com/josenk/terraform-provider-esxi/tree/master/examples-0.13/05%20CloudInit%20and%20Templates
But it seems like the cloud-init script are not being applied to my VM on deployment.
If I deploy the OVA that I made, and run cloud-init status it shows:
root@ubuntuserver:~# cloud-init status status: disabled
I'm not sure if the status should be something else.
To Reproduce Steps to reproduce the behavior:
terraform apply
Expected behavior
The hostname gets changed thanks to cloud-init
Terraform files main.tf
variable "vm_hostname" { default = "randomname" } terraform { required_version = ">= 0.13" required_providers { esxi = { source = "registry.terraform.io/josenk/esxi" } } } provider "esxi" { esxi_hostname = "10.5.1.10" esxi_hostport = "22" esxi_hostssl = "443" esxi_username = "root" esxi_password = "mypassword" } data "template_file" "userdata_default" { template = file("userdata.tpl") vars = { HOSTNAME = var.vm_hostname HELLO = "Hello EXSI World!" } } resource "esxi_guest" "vmtest" { disk_store = "VMSSD" guest_name = var.vm_hostname memsize = 2048 numvcpus = 2 virthwver = 18 power = "on" ovf_source = "http://10.5.0.20/index.php/s/Q6IhdbGcV6flGaa/download?path=%2F&files=Ubuntu Server.ova" network_interfaces { nic_type = "vmxnet3" virtual_network = "VM Network" } guestinfo = { "userdata.encoding" = "gzip+base64" "userdata" = base64gzip(data.template_file.userdata_default.rendered) } }
userdata.tpl
#cloud-config runcmd: - date >/root/cloudinit.log - hostnamectl set-hostname ${HOSTNAME} - echo ${HELLO} >>/root/cloudinit.log - echo "Done cloud-init" >>/root/cloudinit.log
Desktop (please complete the following information):
Sounds like a cloud-init issue to me??? Did you figure this out?
If you have not already done so, generate your image with https://github.com/vmware/cloud-init-vmware-guestinfo
Describe the bug I'm sure this is not a bug, and my issue, but wasn't sure how to best ask a question.
I'm trying to follow
https://github.com/josenk/terraform-provider-esxi/tree/master/examples-0.13/05%20CloudInit%20and%20Templates
But it seems like the cloud-init script are not being applied to my VM on deployment.
If I deploy the OVA that I made, and run cloud-init status it shows:
I'm not sure if the status should be something else.
To Reproduce Steps to reproduce the behavior:
terraform apply
Expected behavior
The hostname gets changed thanks to cloud-init
Terraform files main.tf
userdata.tpl
Desktop (please complete the following information):