Skip to content

CSCfi/imagebuilder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImageBuilder

Fetches and deprecates images for openstack. Images to be fetched/deprecated can be defined within the input.json file which the python script reads.

Please remember to define IMAGEBUILDER_CLOUD and IMAGEBUILDER_NETWORK in your shell.

If you wish to disable ping tests, set the environment variable IMAGEBUILDER_DISABLE_PINGING to anything If you wish to skip fetching new checksums, set the environment variable IMAGEBUILDER_SKIP_CHECKSUM to anything If you wish for a verbose output of all openstack commands being ran set the variable IMAGEBUILDER_DEBUG to anything

This project has been tested to work with Python version 3.12.3 but newer and versions down to 3.9 are very likely to work.

Getting started:

Install qemu-utils (Debian/Ubuntu) or qemu-img (AlmaLinux/CentOS/RHEL) It is required for converting images into RAW files

Create a python virtual environment and activate it like this:

python3 -m venv env

source env/bin/activate

Install required packages from requirements.txt using pip in the virtual environment

pip install -r requirements.txt

Configure a clouds.yaml file according to your needs and place it in one of these 3:

  • the current directory
  • ~/.config/openstack
  • /etc/openstack

Instructions on how to compile a clouds.yaml file

Set your environment variables as such:

  • IMAGEBUILDER_CLOUD should match your clouds.yaml cloud you would like to use
  • IMAGEBUILDER_NETWORK should match the default network the openstack project uses

Now the project is ready to be run!

Examples:

The script is run like this:

IMAGEBUILDER_CLOUD="openstack" IMAGEBUILDER_NETWORK="project_1234" python3 fetch.py

input.json should look something like this.

{
    "current": [
        {
            "image_name": "Ubuntu-24.04",
            "distro":"ubuntu",
            "visibility": "public",
            "image_url": "https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img",
            "checksum_url": "https://cloud-images.ubuntu.com/noble/current/SHA256SUMS"
        }
    ],
    "deprecated": [
        {
            "image_name": "Ubuntu-24.04",
            "filename": "noble-server-cloudimg-amd64.img"
        }       
    ]
}

The data in current also accepts custom properties for images. Here's a list of all possible property values you can set Keep in mind that os_distro is managed by the distro field in your json file.

The data in current can also have a field for "os_type" which can either be set to "linux" or "windows". By default it is set to "linux" so you only need to specify it if you are running Windows.

About

Automated image builder for openstack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages