OpenStack diskimage-builder

Install

sudo apt install -y curl python-pip qemu-utils
pip install diskimage-builder
 
# packages
dib/elements/my_pkg/package-installs.yaml
...
vlan:
wget:
linux-image-generic:
  uninstall: True
 
# change TMPDIR
export TMPDIR=/mnt
disk-image-create -o output.qcow --no-tmpfs vm block-device-gpt ubuntu-minimal

Build IPA image

export DIB_QUIET=0
export ELEMENTS_PATH=/opt/ironic-python-agent-builder/dib:/opt/diskimage-builder/dib/elements
export IMAGE_NAME=ironic-python-agent
export DIB_ELEMENTS=ironic-python-agent-ramdisk
export DIB_RELEASE=focal
 
disk-image-create ${DIB_ELEMENTS} -o ${IMAGE_NAME} --logfile ${IMAGE_NAME}.log

Build Ubuntu image

export DIB_QUIET=0
export ELEMENTS_PATH=/opt/diskimage-builder/dib/elements
export IMAGE_NAME=img-${DIB_RELEASE}-minimal
export DIB_ELEMENTS=foo
export DIB_RELEASE=focal
 
disk-image-create ${DIB_ELEMENTS} -o ${IMAGE_NAME} -t tgz --logfile ${IMAGE_NAME}.log --checksum

dynamic-login
https://docs.openstack.org/diskimage-builder/latest/elements/dynamic-login/README.html
https://docs.openstack.org/ironic/pike/install/include/kernel-boot-parameters.html

Options
https://github.com/openstack/diskimage-builder/blob/master/diskimage_builder/lib/disk-image-create#L52

Elements
https://docs.openstack.org/diskimage-builder/latest/elements.html

Links
https://docs.openstack.org/ironic-python-agent-builder/latest/admin/dib.html
https://docs.openstack.org/diskimage-builder/latest/elements/package-installs/README.html
https://docs.openstack.org/diskimage-builder/latest/
https://media.readthedocs.org/pdf/diskimage-builder/latest/diskimage-builder.pdf