Create a custom OpenStack image with Packer (EN)
Objective
This guide will show you how to create a Packer configuration file to create your own OpenStack image.
Requirements
You'll need an OVHcloud Public Cloud project and a terminal.
Install Packer
Packer can be downloaded from the official website (curently here ) and you'll need to unzip it.
For Linux 64bits
Install the OpenStack plugin for Packer
Install jq
jq is a command line tool for parsing JSON document. It'll be used to automate the configuration file creation.
Fetch your openrc.sh configuration
From OVHcloud Control Panel, fetch your openrc.sh configuration file. You can fetch it from OpenStack menu entry in the left panel and under the ... button on the right Download an OpenStack configuration file. You might need to create an OpenStack user before.
Install openstack command line client
The easier way is to use a python virtual environment
or install your distribution package apt-get install python-openstackclient
Verification
Sourcing the openrc.sh configuration file retrieved before, try your local setup with
Packer configuration
First, source your openrc.sh file with
Next, let's find some needed ID. You'll need the ID of the image, flavor and network. We'll build our image from Ubuntu 24.04 on a b2-7 hardware, with a interface connected on public network Ext-Net
INFO: for FLAVOR_ID, you can directly use the name, ie b2-7
Finaly, create a packer.json file
In the last selection of the configuration file, we specify a setup_vm.sh shell script to be ran.
Building the image
Using the configuration file create above, check it and build the image with
If all went ok, you should have a new image available. You can check with
Tip: To enable debug information: export PACKER_LOG=1
Go further
Join our community of users.