Header Image - Acropolis.Ninja

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.

  1.  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.
  2. Install the cloud-init package. “yum install cloud-init”
  3. 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.
  4. 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.
  5. Screenshot 2016-06-03 18.37.44
  6. Run the cloud-init-generator by typing ./cloud-init-generator
  7. It will ask you for the hostname.  Specify it.  Boom, now you have a file with the same name:
  8. Screenshot 2016-06-03 18.40.20
  9. 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.”
  10. Screenshot 2016-06-03 18.29.40
  11. Now lets scroll to the bottom and upload the file we just created.
  12. Screenshot 2016-06-03 18.41.58
  13. That’s it!  We now have a system that has the hostname set, nutanix user created on the network thanks to our managed network.