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

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

Documentation
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