Skip to content

seanmcconkey/azimuth-images

 
 

Repository files navigation

azimuth-images

This repository contains Packer template definitions for building images for use with Azimuth.

The templates work by provisioning machines in an OpenStack project and configuring them using Ansible before converting to an image. These images are then downloaded from OpenStack and uploaded to S3 for distribution in an Azimuth release.

Building an image manually

Before building an image, you must configure OpenStack authentication, using either an RC file or clouds.yaml, e.g.:

export OS_CLOUD=openstack

This repository has a concept of "environments", allowing builds to be customised for different clouds if required, for example in a fork. These manifest as directories under env, where environment are set that in turn can specify Packer var files under var.

Currently, the repository contains a base environment with cloud-agnostic configuration and an arcus environment that contains configuration for the continuous integration environment, which is kindly hosted on the Arcus cloud at the University of Cambridge.

To build images manually, outside of CI, first ensure you have Packer installed and the required providers installed:

packer init ./config.pkr.hcl

Next, create a Python virtual environment to use and install the Python and Ansible dependencies:

python -m venv .venv
source .venv/bin/activate

pip install -r ./requirements.txt

ansible-galaxy install -f -r requirements.yml

Finally, set up an environment using the arcus environment for inspiration.

You can then build images using the ./bin/build-image script. This script expects the following environment variables to be set:

  • ENVIRONMENT - the environment to use
  • PACKER_TEMPLATE - the Packer template in packer to use
  • ENV_VAR_FILES - the environment variable files to include

The values for PACKER_TEMPLATE and ENV_VAR_FILES can be determined by looking at the defined builds.

For example, to build a workstation image, the following command can be used:

ENVIRONMENT=myenv \
PACKER_TEMPLATE=linux-desktop \
ENV_VAR_FILES=common,kvm,linux,ubuntu-jammy \
./bin/build-image

This will result in a private image being built in the target OpenStack project.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HCL 42.7%
  • Python 33.4%
  • Shell 12.6%
  • Jinja 9.9%
  • JavaScript 1.4%