Diskimage-Builder Roles

ensure-dib

This role installs diskimage-builder and dependencies.

Currently, only Ubuntu and Debian distributions are supported.

Note

The disk-image-create script will be located in {{ dib_venv_dir }}/bin/disk-image-create.

Role variables

ensure_dib_venv_dir
Default: "{{ ansible_user_dir }}/dib"

Directory for the virtualenv to install the diskimage-builder.

ensure_dib_version
Default: undefined

The version of diskimage-builder to install. The default is to install the lastest version.

Output Variables

ensure_dib_command

This variable points to the disk-image-create command installed in the {{ dib_venv_dir }}.

build-diskimage

Role for building images using diskimage-builder.

Diskimage-builder and diskimage elements can be configured by passing corresponding settings as environment variables to this role, or using the build_diskimage_environment variable.

By default the build-disk-image command does not print its output to stdout, but only to a log file in the configured log directory. To additionally log to stdout, set DIB_QUIET: 0 in build_diskimage_environment.

Example:

roles:
 - name: build-diskimage
   environment:
     ELEMENTS_PATH: /tmp/elements
     DIB_PYPI_MIRROR_URL: https://example.com

Role variables

build_diskimage_command
Default: "{{ ensure_dib_command }}"

Path to the build-disk-image command. This defaults to {{ ensure_dib_command }}. as being set by the ensure-dib role.

build_diskimage_image_name

Name of the image to build.

build_diskimage_formats
Default: ['qcow2']
Type: list

List of image types to generate.

build_diskimage_elements
Default: ['ubuntu', 'vm']
Type: list

List of elements that should be used when creating the disk image.

For ease of use with YAML anchors, this may be provided as a list of lists which will be flattened automatically.

build_diskimage_environment
Type: dict

Environment variables for the diskimage builder command may be supplied using this variable (or by directly using the Ansible environment argument).

build_diskimage_image_root
Default: "{{ ansible_user_dir }}/dib-images"

Directory to store the build images.

build_diskimage_logs_dir
Default: {{ ansible_user_dir }}/zuul-output/logs

The path where the log output of the diskimage-builder shall be written to

build_diskimage_retry_limit
Default: 0

The number of times the build-diskimage command shall be retried until successful.

build_diskimage_retry_delay
Default: 120

The number of seconds to wait between retries of the build-diskimage command.

convert-diskimage

This role converts diskimages from one format to other using the qemu-img tool.

Currently, only Ubuntu and Debian distributions are supported.

Role variables

convert_diskimage_source_image

The path to the source image file.

convert_diskimage_target_image

The path of the desired target image file.

convert_diskimage_target_image_formats
Type: list

The desired formats of the target image. Supported values are “raw” and “qcow2”.