/srv/irclogs.ubuntu.com/2021/09/07/#cloud-init.txt

=== cpaelzer_ is now known as cpaelzer
kruster95hi all 12:55
kruster95i want to use cloud-init and terraform to configure my virtual server (vmware), i am looking for some documentation, if you can give me a hand. thank you12:57
minimalkruster95: well basically you either need a pre-existing VM image that has cloud-init enabled or you need to build a VM yourself. The VMware DataSource changed/a new one was added recently so not sure if any official Linux distro cloud images have the new DataSource yet. Which distro are you using?13:04
minimalOnce you have a suitable VM image then when you create a VM using terraform you supply the user-data as part of the terraform action13:05
kruster95minimal : I have my rhel8 template with cloud-init to install13:13
minimalso have you actually tried creating a VM using terraform and passing user-data to it?13:13
kruster95and my block in terraform :   extra_config = {13:13
kruster95    "guestinfo.metadata"          = base64encode(file("${path.module}/templates/metadata.yaml"))13:13
kruster95    "guestinfo.metadata.encoding" = "base64"13:13
kruster95    "guestinfo.userdata"          = base64encode(file("${path.module}/templates/userdata.yaml"))13:13
kruster95    "guestinfo.userdata.encoding" = "base64"13:13
kruster95  }13:13
kruster95nothing happens13:14
minimaland did you log into the created VM and look at /var/log/cloud-init.log to see what happened?13:14
kruster95I have nothing special in the logs13:15
minimalnothing special? did it setup network config based on the VMware DataSource?13:16
minimaldid it see the user-data and act upon any of it?13:16
kruster95the network is correctly configured13:21
kruster95how does my vm interact with terraform?13:22
minimalkruster95: and the DataSource that the logs indicate was used?13:22
kruster95on my template, I have not configured a datasource13:23
kruster95I just installed cloud-init13:23
minimalyour VM does not interact with Terraform, Terraform is used to create the VM via which hypervisor (VMware in this case) is used and it passes the cloud-init metadata and network config and user-data to the hypervisor to pass on (in some way) to the VM's cloud-init13:23
minimalIn the /var/log/cloud-init.log it will indicate which DataSource was used during boot13:24
kruster95"DataSourceOVF.py[DEBUG]: VMware Virtualization Platform found"13:25
kruster95I can see the network configuration in the logs13:26
minimalok, so it used the OVF datasource13:27
minimalso is there any reference to user-data in the logfile?13:27
kruster95no precisely, i think i have a config problem in terraform.13:30
minimalYou probably should read https://cloudinit.readthedocs.io/en/latest/topics/datasources/ovf.html13:30
minimalthere are notes there about VMware specific config settings13:30
minimalwhy focus on terraform as the likely problem? I suspect it is either the cloud-init settings for the OVF DataSource or the VMware configuration13:31
kruster95because my custo is in terraform13:32
minimalcusto?13:32
kruster95customization13:33
kruster95create users 13:33
kruster95install package13:33
minimalterraform simplly passes this to VMware13:34
minimalin the OVF document I referenced did you read this? "On VMware platforms, VMTools use is required for OVF datasource configuration settings as well as vCloud and vSphere admin configuration."13:34
minimalhave you setup VMTools?13:34
kruster95yes it is correctly configured13:38
minimalI'm not familiar with VMware, so are there some logs where you can check if (a) VMware received the user-data from Terraform and (b) if VMware supplied the user-data to cloud-init?13:40
minimalkruster95: in cloud-init code for OVF DS I see this comment: "When the VM is powered on, the "VMware Tools" daemon copies the customization specification file to /var/run/vmware-imc directory. cloud-init code needs to search for the file in that directory which indicates that required metadata and userdata files are now present."13:56
minimalso does /var/run/vmware-imc directory exist on the booted VM and does it contain anything?13:56
Paulhello, was trying to determine which stage OVF data is actually read in, my suspicion is that it is read in the local stage, but I can't seem to find that documented.  Does anyone know if this is true and where it might be documented?21:26
=== Paul is now known as Paul88
Paul88yea, think i confirmed it, it checks for the OVF data between starting "init-local" (cloud-init-local.service), and when it says it is starting "init" (cloud-init.service) in the logs. 22:07
rharperPaul88: it's not clearly documented,  in the context of cloud init,  in code, seeing the sources.DEP_FILESYSTEM indicates that it runs as soon as cloud-init init --local runs and searches for datasources that are detectable without networking, https://github.com/canonical/cloud-init/blob/main/cloudinit/sources/DataSourceOVF.py#L710  22:13
Paul88Thank you Ryan22:13

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!