Provision ESXi with MAAS


Duration: 5:00

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

Getting started

Duration: 10:00

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

Creating your image

Duration: 3:00

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.

Uploading your image

Duration: 2:00

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:

Deploying your image

Duration: 2:00

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:

Next steps and finding help

Duration: 1:00

MAAS has been designed to be a modern, agile machine provisioning solution, enabling both physical and virtual infrastructure. MAAS can deploy Ubuntu, CentOS, RHEL, Windows and now ESXi like a bare-metal cloud. If you need help as you are using it reach out to:

Reference literature:

I noticed in the packer .json config file that the curtin-hooks file is being tucked in partition 1 during the packer build process. Does this imply that esxi bootloader ( I’m guessing syslinux ) is going to run curtin prior to the first boot and execution of the kickstart file

How do I configure the passwords?

I was finally able to create the image without errors after installing the required submodules from git.

But now getting this error during deployment

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/curtin-hooks-1fkh013g/maas/curtin.cfg'

Edit this file before creating your image.

I fixed my error by manually copying and renaming my image to the correct directory on maas.

Got this answer from: Deploying Vmware ESXI with ssh enabled by editing vmware-esxi-ks.cfg

It seems with the current version of packer there are some changes with the way checksums are required.

I had to run packer fix vmware-esxi.json > vmware-esxi-new.json to ‘upgrade’ the template.

Now I get “A Checksum must be specified” error here.

Error: Failed to prepare build: "qemu"
1 error(s) occurred:
* A checksum must be specified

Debug mode enabled. Builds will not be parallelized.
==> Wait completed after 3 microseconds
==> Builds finished but no artifacts were created.

I am new to both packer and MAAS, and i’m actually just trying to run a POC to see if we want to use it in future production.

I cannot seem to find the syntax to ‘specify a checksum’. Would this be put into the template itself?

MAAS ESXi packer scripts Get it here

MAAS ESXi packer scripts from the link is out of date. For correct work you should use scripts from the git

The new repo worked!

I can successfully install ESXi server but MAAS controller still thinks ESXi is being installed. Is there anyway to have it showed up as deployed?

Uploading the image into the maas gives the following error.

sudo maas admin boot-resources create name=‘esxi/6.7’ title=‘VMware ESXi 6.7’ architecture=‘amd64/generic’ filetype=‘ddgz’ content@=vmware-esxi.dd.gz
{“architecture”: ["‘amd64/generic’ is not a valid architecture. It should be one of: ‘’."]}