Skip to main content

The Image Generator

Project description

A python based generator for lxc images.

It will read a configuration from a yaml file, starts a container accordingly, copies and runs specific scripts and in the end creates a lxc image.

Prerequirements

You have lxc/lxd installed and configured properly, depending on your desired image and scripts the container may need internet connectivity. You have at least one lxc image already downloaded which you can find in your local lxc image store

lxc image list

Install

Install via :

pip install image-generator

How to use

It is possible to run it in two way. single action or with config file. The config file is a yaml file containing on the root a list of action to be executed in order with some paramters.

Each action has specific paramters that are listed in the following section

Configure

The config file should look like:

connect:
  url: < The URL with port where to reach lxc >
  trust-password: < The trust password you have set >

# Both of these values require that you have set the related values in the lxc config
    # lxc config set core.https_address "[::]"
    # lxc config set core.trust_password < Your Password here >

create-container:
  container-name: < The name of the container which will be created >
  container-image-fingerprint: < The fingeprint of the image which will be used as base image for the container >

# You do not need the complete image fingerprint, the one shown by lxc image list is enough

copy-files:
  file-tarball: < Path to the tar archive containing all scripts you want to push on the image >
  file-dest:  < Path where to copy the content of the tar archive on the container >

execute-script:
  script: < Which script to be executed >
  clean-tmp-files: False # remove the temporary files used for copying the tarball on the container (default: False)

# lxc always assumes you are in /root, thus take care if you use relative paths to the scripts here

create-image:
  destination: < Path and Name of the image you are saving >
  alias: "Published by image-generator" # additional alias to give to the created image (default: "Published by image-generator")

# if the destination does not yet contain the ending tar.gz it will be added automatically

clean:
  container: < True or False > # remove the container used for creating the lxc image
  image-store: < True or False > # remove the image created from the container from your local image store

# You can (re)import the images anytime by lxc image import < Your path to the desired image.tar.gz > --alias < Your Alias here >

Run

image-generator -f etc/image.yaml

Uninstall

Uninstall via :

pip uninstall image-generator -y

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

image-generator-1.0.0.tar.gz (12.2 kB view hashes)

Uploaded Source

Built Distribution

image_generator-1.0.0-py2.py3-none-any.whl (10.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page