«

»

Apr 25 2017

Deploy and customize multiple Linux VMs on Nutanix AHV

“VMTurbo"
A while back I wrote a blog post Nutanix AHV and Linux VM Guest Customization where I used cloudinit to customize a Linux virtual machine (VM) after deployment. Based on that I have been asked how to do this when you’ll like to deploy multiple VMs same time. For testing purposes i have used a deployment script running on any Nutanix Controller Virtual Machine (CVM) in the Nutanix cluster.

The deployment script (called cloudinit) calls a cloud init input file (cloudinitinputfile) who takes care of the VM guest customisation. Link to cloudinit file and to and cloudinitinputfile.

Follow the below steps to deploy and customize multiple Linux based VMs on AHV and customize

  • Create clouding directory on CVM
    • mkdir /home/nutanix/cloudinit
  • Paste the cloudinit script in a file called cloudinit
  • Make adjustments to the following script sections
    • basevm – The VM to be cloned
    • vmprefix – name of the VMs provisioned by the script. The script will add a number at the end of the name.
    • numvms – Number of VMs to be deployed
    • cloudinitfilevmname – Name used in the cloudinitinputfile listed as hostname and fqdn. The cloudinitfilevmname will be changed for vmprefix name for each VM deployed to guarantee a unique hostname in each VM.
    • container – Container where the VMs are deployed.
  • Paste the Cloudinitinput file listed here in a file called cloudinit input file.
  • Run the script by invoking the following command:
    • /home/nutanix/cloudinit/cloudinit

Below is the output from the command where i created 4 VMs using the script.

Cloudinit Script

Cloudinit Input File

This script was tested on AOS 5.0.2 and AHV 20160925.43

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">