Create custom images

Crafting custom Ubuntu images for MAAS: a packer tutorial

Creating a custom Ubuntu image for MAAS can be a breeze with Packer. This tutorial takes you through the essentials: from prerequisites to building and finally deploying your custom image.

Get ready: the prerequisites

Before diving in, ensure your system is up to speed:

  1. Install packer:

    sudo apt install packer
  2. Gather the dependencies:

    sudo apt install qemu-utils qemu-system ovmf cloud-image-utils

Clone your templates: get the packer blueprints

Here’s how to pull the essential Packer templates for MAAS:

git clone

Craft your image: build a custom Ubuntu for MAAS

Time to create the magic. Follow these steps:

  1. Navigate to the template directory:

    cd packer-maas/ubuntu
  2. Fire up the build:

    make custom-ubuntu-lvm.dd.gz

This process will take a few moments. Good time for a cup of tea.

Push to MAAS: upload your masterpiece

With your image built, it’s time to make it accessible in MAAS:

maas $MAAS_USER boot-resources create name=custom/ubuntu architecture=amd64/generic filetype=ddgz content@=custom-ubuntu-lvm.dd.gz

Deployment: unleash your custom image

Finally, deploy your custom image onto a node in MAAS:

  1. Deploy the image to a node:

    maas $MAAS_USER machine deploy $SYSTEM_ID osystem=$OS [$distro_series=$DISTRO]
  2. Confirm it’s really yours:

    maas $MAAS_USER machines read | jq '.[] | {hostname, osystem}' 

That’s it! You’ve built and unleashed your custom Ubuntu image into the MAAS ecosystem. For those eager to dive deeper, consult the Packer MAAS documentation^ for advanced practices.

Last updated a month ago.