Create custom images

This tutorial covers building custom Ubuntu images for MAAS using Packer.

Prerequisites

  1. Install Packer:

    sudo apt install packer
    
  2. Install dependencies:

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

Getting the Packer templates

Clone the Packer MAAS templates:

```
git clone https://github.com/canonical/packer-maas.git
```

Building a custom image

  1. Navigate to the template directory:

    cd packer-maas/ubuntu
    
  2. Build the image:

    make custom-ubuntu-lvm.dd.gz
    

This will take a few minutes to complete.

Uploading to MAAS

Upload the image to MAAS:

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

Deploying the Image

  1. Now deploy the custom image to a node in MAAS.

  2. Check the node details to confirm the custom OS:

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

With these steps, you’ve built and deployed a custom Ubuntu image with Packer and MAAS. Refer to the Packer MAAS documentation for more advanced usage.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.