Learn how to create a Packer configuration file to create your own OpenStack image.
Requirements
- An OVHcloud Public Cloud project
- A terminal
OVHcloud Control Panel Access
- Direct link: Public Cloud Projects
-
Navigation path:
Public Cloud
Instructions
Install Packer
Packer can be downloaded from the official website (currently here), and you'll need to unzip it.
For Linux 64-bit
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
You can retrieve the openrc.sh file from the OVHcloud Control Panel using the procedure documented in this guide.
Install OpenStack command line client
The easiest 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, 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 an interface connected on a public network Ext-Net.
For FLAVOR_ID, you can directly use the name, e.g. b2-7.
Finally, create a packer.json file:
In the last selection of the configuration file, we specify a setup_vm.sh shell script to be run:
Building the image
Using the configuration file created above, check it and build the image with:
You should have a new image available. You can check with:
TIP: To enable debug information, use export PACKER_LOG=1.
Go further
For more information and tutorials, please see our other Public Cloud support guides or explore the guides for other OVHcloud products and services.