Set VM IP/MASK/GW during the provisioning

automate

#1

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.


#2

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


#3

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

pemcg


#4

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?


#5

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.


#6

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


#7

@pemcg, this solution applies only for Linux CS?


#8

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


#9

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


#10

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


#11

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?


#12

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