Provision hosts without SSH using VMware & user_data template

  • Foreman version: 1.21
  • VMware vSphere version: 6.7

I’ve been able to provision VMware hosts using PXEbooting a couple dozen times.

Now, I’m interested in provisioning VMware hosts using “Image provisioning without SSH” and I’m a little confused about what I need.

Question 1: The instructions say

  • Enable user_data checking the proper checkbox in the compute resource definition

If I browse to “Infrastructure > Compute Resources > my vCenter instance > Edit”, there is no checkbox for user_data. However, I do see an option under “Images”.

Is that referring to this screen under “Infrastructure > Compute Resources > my vCenter instance > Images”? (It’s not a Compute Resource itself, but it’s an image/template within the Compute Resource).

Question 2:

I’ve associated the “UserData default” template with the “Ubuntu 18.04 LTS” operating system:

When I check for template resolution under the “Operating System” tab, I don’t see a User Data template. Should I expect to see one?

If I continue with the provisioning at this step, Foreman complains with the error ERF42-5701 [Foreman::Exception]: The user-data template must be a hash in YAML format for VM customization to work.

What did I miss? Can I have a finish template and a user data template associated with the same OS?

Hello,

  1. yes, the user data needs to be set on image level, not compute resource itself. We’d appreciate improvements to our documentation to make it clearer. Changes go to https://github.com/theforeman/theforeman.org

  2. I think the template should be listed there. Make sure it is assigned to the org/loc that you create the host in. Also maybe you need to disassociate the finish template.

Hope that helps

Yeah, the template seems to be in the right org/loc. When I disassociate the finish template, Foreman complains that it cannot find any templates at all:

Just not sure if this is my mistake, or if it’s a Foreman bug.

PR submitted!

1 Like

So, I managed to fix this finally by going into the UserData default template and associating it with a Host Group.

It’s also associated as the Operating System default, but for some reason, it wasn’t getting recognized.

Unfortunately, creating a new HostGroup does not lead to the desired result.

I observed the following behavior:

If no host group is selected, the UserData template is used but not the cloud-init.
When selecting the host group, the Kickstart default finish template is used, but not the cloud-init.

Have you read this guide:

https://docs.theforeman.org/nightly/Provisioning_Guide/index-foreman-el.html#Provisioning_Virtual_Machines_in_VMware_vSphere-Provisioning_with_cloudinit_and_userdata_templates

There should be everyhing described.

I followed the steps as in the instructions. It has also worked so far without any problems. The images which have worked before now unfortunately no longer work. Do you have any idea where to look up how the decision of the used template is made?

Thank you very much.

1 Like

Images?

Then I start the deployment process, select the image and now the correct templates should appear or be assigned. However, these do not appear.

If anything does not show up, check up your taxonomy (Organizations and Locations). This is a common mistake users do.