Learn how to create a Packer configuration file to create your own OpenStack image.
Requirements
You'll need an OVHcloud Public Cloud OpenStack project and a terminal.
Install Packer
Packer can be downloaded from the official website (currently here ) and you'll need to unzip
it.
For Linux 64bits
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 OpenStack's RC 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 16.04
on a vps-ssd-1
hardware, with an interface connected on a public network Ext-Net
.
FLAVOR_ID
, you can directly use the name, e.g. vps-ssd-1
Finaly, 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:
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.