Foreman 1.23 Image based provisioning with VMware vSphere- "globalIPSettings are required when using Customization Spec"

Problem:

I upgraded to Forman 1.23 and I’m trying to use Image-based provisioning. When I try to provision a new host using the “Image-Based” provisioning method and hit ‘Submit’, Foreman complains with this error:

Failed to create a compute vmware.example.org (VMware) instance stefantest1.example.org: ERF42-5701 [Foreman::Exception]: The user-data template must be a hash in YAML format for VM customization to work.

When I hit the Operating System > Provisioning Templates > Resolve button, it says:

Templates resolved for this operating system
Finish template Template Preseed default finish

I feel like I missed a template association somewhere.

Does anyone have a walkthrough on how to set up Image-based provisioning using Foreman 1.23 and vSphere?

I figured this error out.

  1. The error “globalIPSettings are required when using Customization Spec” comes from vSphere itself-- it’s complaining that the template did not include the globalIPSettings parameter. There’s only one default template that includes this parameter, which is the UserData open-vm-tools template, so I used that.

  2. The second error “The user-data template must be a hash in YAML format for VM customization to work.” was happening because the User Data template associated with my host, which was UserData default was not in YAML format. The UserData open-vm-tools template happens to be in YAML format, so that’s what I need.

Interestingly, when provisioning the host the UserData template never shows up when I hit the Resolve button, which is why I didn’t see it in the screenshot above. It does appear after the host is provisioned, however.

So, it seems that the User Data templates must be YAML, and vSphere expects a few parameters to be in the template.

In the screenshot above, I was seeing Preseed default finish because it’s associated with Ubuntu 18.04 Operating System. The host wasn’t picking up the UserData template until I created a special Host Group and associated the UserData open-vm-tools template to the new Host Group.

I realized that I combined two errors in my original post. Apologies for creating confusion.

3 Likes

For the record, documentation is here:

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

2 Likes

Thanks I’ll check it out.

BTW I really like the new Time sequence diagram-style that is being used here. It makes lots of sense to me.

1 Like

Perhaps something has changed in how VMware does things, or I’ve completely missed a critical aspect of how image-based deployments work.

I’m trying to create an instance based off a template that was generated as follows:

  • PXE provision a host on vSphere
  • Run an Ansible playbook that does all the steps documented in the Foreman and Satellite docs
    • Install dependencies (cloud-init, open-vm-tools, perl)
    • Go through all the cleanup steps
    • Purge necessary files
    • Unregister system from Katello and clean DNF
    • Power down
  • Convert to template

I’ve configured the OS (EL8) to use the CloudInit default and UserData open-vm-tools templates. When trying to deploy an image based on this template, I get hit with the following output:

Failed to create a compute vSphere (VMware) instance newvm.corp.net:
  InvalidRequest: Required property ipAddress is missing from data object of type CustomizationFixedIp
    while parsing serialized DataObject of type vim.vm.customization.FixedIp at line 1, column 4895
      while parsing property "ip" of static type CustomizationIpGenerator
    while parsing serialized DataObject of type vim.vm.customization.IPSettings at line 1, column 4851
      while parsing property "adapter" of static type CustomizationIPSettings
    while parsing serialized DataObject of type vim.vm.customization.AdapterMapping at line 1, column 4797
      while parsing property "nicSettingMap" of static type ArrayOfCustomizationAdapterMapping
    while parsing serialized DataObject of type vim.vm.customization.Specification at line 1, column 4325
      while parsing property "customization" of static type CustomizationSpec
    while parsing serialized DataObject of type vim.vm.CloneSpec at line 1, column 321
      while parsing call information for method CloneVM_Task at line 1, column 177
      while parsing SOAP body at line 1, column 167 while parsing SOAP envelope at line 1, column 0
      while parsing HTTP request for method clone on object of type vim.VirtualMachine at line 1, column 0

Only thing I can think of at this point is that the subnet used for this infra uses DHCP rather than static for its “Boot Mode”, would this be the cause?

Can’t seem to edit my post, meant to add this is with Foreman 3.5.1.