Provision ESXi with MAAS

1. Overview

In this tutorial, you will learn how to create MAAS images of ESXi using MAAS provided packer scripts.

ESXi support was first introduced in MAAS 2.5, but expanded in 2.6 allowing for the configuration of VMFS datastores, registration to vCenter and others. For more information about what features MAAS support, please refer to the following blog post Provisioning ESXi with MAAS: An Overview.

In order to create ESXi images MAAS leverages the use of packer, and alongside the image creation process, it introduces a series of scripts and dependencies that makes it possible for MAAS to customize each ESXi deployment, including network configuration, datastore creation and user level customization.

What you’ll learn

  • Create an ESXi image
  • Upload an ESXi image to MAAS
  • Deploy an ESXi image over the WebUI & API

What you’ll need

2. Getting started

The first step is to create a working directory:

mkdir -p ~/maas-esxi

Then, move all the downloaded files (Packer, ESXi ISO and the MAAS ESXi scripts) to the working directory (In this example, we are moving them from ~/Downloads/):

mv ~/Downloads/VMware-VMvisor-Installer-6.7.0-8169922.x86_64.iso ~/maas-esxi
mv ~/Downloads/ ~/maas-esxi
mv ~/Downloads/packer-maas-1.0.2.tar.xz ~/maas-esxi
cd ~/maas-esxi

Finally, unpack the ESXi MAAS packer scripts tarball:

tar xJvf packer-maas-1.0.2.tar.xz

3. Creating your image

To create the images, ensure you are in the right directory (This is the directory where these MAAS packer files are stored):

cd ~/maas-esxi/packer-maas-1.0.2/vmware-esxi/

Then load the nbd driver. This will allow the injection of specific MAAS files into the image:

sudo modprobe nbd

After loading the driver, the image creation can be started:

sudo packer build -var 'vmware_esxi_iso_path=~/maas-esxi/VMware-VMvisor-Installer-6.7.0-8169922.x86_64.iso' vmware-esxi.json

Please note that you can watch the image creation process by opening a VNC session on The successfull completion of the image creation with result in the following output:

Warnings for build 'qemu':

* A checksum type of 'none' was specified. Since ISO files are so big,
a checksum is highly recommended.

==> qemu: Downloading or copying ISO
    qemu: Downloading or copying: file:///home/ubuntu/maas-esxi/VMware-VMvisor-Installer-6.7.0.update02-13006603.x86_64.iso
==> qemu: Creating hard drive...
==> qemu: Starting HTTP server on port 8911
==> qemu: Looking for available port between 5900 and 6000 on
==> qemu: Starting VM, booting from CD-ROM
    qemu: The VM will be run headless, without a GUI. If you want to
    qemu: view the screen of the VM, connect via VNC without a password to
    qemu: vnc://
==> qemu: Overriding defaults Qemu arguments with QemuArgs...
==> qemu: Waiting 3s for boot...
==> qemu: Connecting to VM via VNC
==> qemu: Typing the boot command over VNC...
==> qemu: Waiting for shutdown...
==> qemu: Running post-processor: shell-local
==> qemu (shell-local): Post processing with local shell script: /tmp/packer-shell536780074
    qemu (shell-local): /dev/nbd4 disconnected
    qemu (shell-local): /dev/nbd4 disconnected
==> qemu: Running post-processor: compress
==> qemu (compress): Using pgzip compression with 4 cores for vmware-esxi.dd.gz
==> qemu (compress): Archiving output-qemu/packer-qemu with pgzip
==> qemu (compress): Archive vmware-esxi.dd.gz completed
Build 'qemu' finished.

==> Builds finished. The artifacts of successful builds are:
--> qemu: VM files in directory: output-qemu
--> qemu: 
--> qemu: compressed artifacts in: vmware-esxi.dd.gz

The result of this is an image called vmware-esxi.dd.gz.

4. Uploading your image

To upload your image, first log-in to MAAS ( via the CLI:

maas login admin

And upload the image with the following command:

maas admin boot-resources create name='esxi/6.7' title='VMware ESXi 6.7' architecture='amd64/generic' filetype='ddgz' content@=vmware-esxi.dd.gz

You can verify the image download in the ‘Images’ tab in your MAAS:

5. Deploying your image

Now that the image is available, we can go ahead and deploy a machine. In this example, we will use the machine with system_id ‘yawrmb’:

maas admin machine deploy yawrmb osystem=esxi distro_series=6.7

Or it can be done over the Web UI:

6. Next steps and finding help