Set VM IP/MASK/GW during the provisioning

Hi all,

I would like to know if there is a way to set the IP configuration for a VM(VMWare) during of provisioning.

I installed the PHPIPAM 1.3 and imported the extension into MIQ.
During the provisioning/retirement the IP is being correctly reserved/retired on PHPIPAM server, but the IP is not set on the VM after the provisioning.

Any idea what i’m missing or maybe you could could advise another solution/approach?

Thank you.

You should be able to set it via the options-hash during provisioning

request.options[:dns_domain] = nil
request.options[:dns_servers] = nil
request.options[:dns_suffixes] = nil
request.options[:gateway] = nil
request.options[:hostname] = nil
request.options[:ip_addr] = nil

If you are not familiar with it, you should read up on how Provisioning in ManageIQ works

You’d need to use a VMware Customization Specification to inject the IP details into the new VM at first boot.


Thank you for your answer. Correct me if i’m wrong, but using VMware CS will configure the VM with the settings defined in the CS file, in my case it will set on VM the IP configuration defined in the CS file right? Which means that I will have to update the VMware CS with new IPs for each new VM provisioning?

If you specify a Linux CS in the Customization tab of the VM provisioning dialog, then the options hash values that @buc mentioned will be used by the CS automagically.

See How to configure hostname and ip address for VMware VM provisioning

@pemcg, this solution applies only for Linux CS?

I believe it can be used for Windows VMs as well (but I’ve never tried)

If vmware tools is installed on your template, it works. You can even set administrator password (this is not working for Linux guests).

You need to have one Customization Specification for Linux and another one for Windows (At least we configured it that way). When creating the Catalog-Item, you can select the Template MIQ clones the VM from and the Customization Spec it uses

Thanks to all for your answers.
@buc, the options hash values that you have suggested to use, how it used to dynamically acquire an IP for example? We are in an multi tenant environment with several vlans. How can I assign the network configuration to VM based on vlan ID? How can I set the next available IP from a subnet?

In the VM Provisioning StateMachine / Infrastructure / VM / Provisioning / StateMachines / VMProvision_VM / template there is a Step called Provision . At this point ManageIQ will clone the VM from the template (selected in the Catalog-Item) and apply the Customization Specification (also selected in the Catalog Item) and will use whatever values are in the options-hash at at that point in time

Therefore you need to acquire an IP address from your IPAM and save it in the options-hash before the Provision Step in the StateMachine. ManageIQ gives you the possibility to configure which network (on the VMware vSwitch) the VM will be connected to and what OS-settings the VM will use.
It is your Job to acquire an appropriate IP address from your IPAM, map the VLAN-ID to the correct vSwitch and make sure that all the settings work together