Customize linux guests with AHVs built in cloud-init feature.
The time was finally here. I have been slammed lately with meeting and installs and meeting new partners. Today, I had a scheduling cancellation so finally had some time to test out this cloud-init feature. For those unfamiliar (including me until recently), cloud-init is a “defacto multi-distribution package that handles early initialization of a cloud instance.” You can read more about the features here.
Anyways, using the feature with regards to AHV (Acropolis Hypervisor) is actually pretty easy. Basically, on AHV the installation of cloud-init is automated for you. To use this feature there a few things you must know and knock out first.
- Configure your linux master template the way you want. I installed a new Centos 6.5 one from iso. Configure the root passwd, and also delete the persistent rules in /etc/udev/rules.d/persistent-rules-net.rules.
- Install the cloud-init package. “yum install cloud-init”
- You will also need a cloud-init config file for when we provision the new server vm. You can create your own file, but I will show you the quick generator I wrote.
- Create your own file or generate one with the generator. You will need to vi the file first and set your envirnment specifics such as domain name and username, etc.
- Run the cloud-init-generator by typing ./cloud-init-generator
- It will ask you for the hostname. Specify it. Boom, now you have a file with the same name:
- Now assuming you are using AHV’s built in IPAM with managed networks you don’t have to worry about specifying IP address information. IP will be set for the life of the VM. Let’s now create the new VM. High light your existing template and choose “Clone.”
- Now lets scroll to the bottom and upload the file we just created.
- That’s it! We now have a system that has the hostname set, nutanix user created on the network thanks to our managed network.