I have created a VMware template image for provisioning hosts in Foreman using UserData. I have cloud-init installed and configured on the template image and the following userdata provisioning template. It appears to be able to provision the machine correctly up to the point of configuring the network information of the NIC. No matter what I tried, it always came up with DHCP.
The template image is CentOS 7.5 minimal install, with puppet-agent and cloud-init (configured to point to Foreman). Foreman is running version 1.18.1 and VMware vSphere is 6.7.
VMWare has actually special cloud-init limited scope support, it
does not pass the cloud-init into the image as-is, but rather converts
it into individual actions referred as Custom Spec in VMWare docs.
Only some fields are converted, the rest is unused. It does not accept
“call home” wget/curl call therefore VMWare VMs initialized with
cloud-init stays in build mode forever. This is known limitation.
I actually found this guide before and tried to follow it. It’s where I got the UserData template from. However, I am not quite sure where to put the other 2 templates. They appear to be cloud-init templates. Are they supposed to be created in Foreman and linked up to the OS or do they actually live as config on the VMware image template?
The former. The cloud-init templates are supposed to be set up in Foreman and linked to the OS. Do you mind clarifying the guide? It’s always hard to think of every pitfall when actually know what’s needed. Either send a pull request or post the updated version in this thread.
I’ll try to add the templates to the plugin so that they are seeded when you install them.
Time if you are interested, I can help pushing this into core. This is very useful. The only issue is the new controller, I think this belongs to the unattended controller. It’s just another kind, no magic if I am not mistaken.
thank you for the clarifications.
I came across the same situation of @eroji in the exact way:
Provisioning a new host from image cloning a CentOS 7.5 template on VMware
Entering manually the IP of the new cloned VM in Foreman UI
Using the custom “user_data” Template
Following Foreman manual chapter 5.2.9
The same process can also be done using a user_data template. To configure image/template-based provisioning without SSH, make the following adjustments for the former procedure:
*** Enable user_data checking the proper checkbox in the compute resource definition**
*** Associate a user_data template to the host, using cloud-init syntax**
*** Note that the images dont need cloudinit installed, as the cloudinit is converted under the hood to a CustomisationSpec object that VMware can process**
The template is correctly cloned, but there is no customization about hostname and network.
Could you please help me debugging the call from Foreman to VMWare APIs to check what is going wrong?
Hello, I tried to use foreman_userdata, but I don’t think I got it right; when I try to create the host, it says “globalIPSettings are required when using Customization Spec”, although I can clearly see that this is defined in the userdata openvm-tools.
Also when configuring the host to be created, under the Operating System tab, when I click on the “Resolve” button for Provisioning Templates, it gives me “Sorry but no templates were configured.”, when there are 2 templates associated with the OS: userdata openvm-tools as provisioning and cloud-init default as user_data.