We ship five base images: debian-12, debian-13, ubuntu-22.04, ubuntu-24.04 and rocky-9. Customers can build their own from any of those with one command. The pipeline underneath is deliberately plain. Nothing in it would surprise a sysadmin from 2012, which is the idea.
The stages
- Bootstrap. We build a minimal root filesystem with
mmdebstrap(ordnf --installrootfor Rocky) from a dated snapshot of the distribution archive that we mirror in each site. A build names a snapshot, for instance 2026-02-03, so the package set is a fact and not a hope. - Configure. An Ansible playbook runs against the unpacked tree through the
community.general.chrootconnection plugin. It installs the packages the image asks for, applies the hardening role, writessshd_configand sets up cloud-init in NoCloud mode. - Seal. Remove the build residue: apt lists,
/var/log, the machine-id (truncated touninitializedso that systemd generates one at first boot), SSH host keys. - Pack. The tree becomes a GPT disk image (EFI partition, root partition) and is compressed with
zstd -19. A minimal Debian 13 image is 3.1 GB raw and about 420 MB compressed. - Test. We boot the raw image in QEMU with a tiny cloud-init seed and run a
testinfrasuite over SSH. It checks that the machine-id is regenerated, that root login is disabled, that the expected packages are present and that no forbidden ones are. A failing test stops the build. - Sign and publish. The compressed image and a checksum file are signed with
minisign, then pushed to the mirror in each site. Provisioning refuses an image whose signature does not verify.
What a customer writes
name: batch-debian13
base: debian-13
size_gb: 20
packages:
- chrony
- nvme-cli
- prometheus-node-exporter
project: platform-playbooks
playbook: playbooks/harden.yml
$ acloud image build --from image.yml --wait
building batch-debian13 (img_01J9...) ... bootstrap
building batch-debian13 (img_01J9...) ... configure
building batch-debian13 (img_01J9...) ... test
batch-debian13 ready in 6m12s (sha256 4c1d...e07a)
$ acloud server create --site chicago --plan c2.32 --image batch-debian13 --name batch-01 --ssh-key laptop --wait
The same operation is available as POST /v1/images. It returns 202 with a status of building, and you poll GET /v1/images/{id} or subscribe to the image.ready webhook.
Why seven minutes
Writing the image is fast. The installer environment that boots over PXE fetches the compressed image from the local mirror over HTTPS, verifies the signature, and streams it to the disk:
curl -fsS "$IMAGE_URL" | zstd -d | dd of=/dev/nvme0n1 bs=4M conv=fsync status=none
sgdisk -e /dev/nvme0n1
On a c2.32 that takes about 40 seconds. The root partition is grown on first boot by cloud-init. The rest of the roughly seven minutes between POST /v1/servers and an SSH prompt is firmware: server POST, memory training and the network boot. The 1 TB machines are the slowest, at nearly five minutes before the PXE ROM even runs. We have tried every BIOS option we could find. Some of that time is just the machine counting its memory.
Reproducibility, or the lack of it
The goal was that two builds from the same snapshot and spec give byte-identical root filesystems. We set SOURCE_DATE_EPOCH from the snapshot date and normalized file timestamps. Even so, the first CI run that built twice and compared hashes found four differences:
/var/cache/ldconfig/aux-cache, which records timestamps. Deleted in the seal stage./etc/machine-idcontents. Truncated.- Python bytecode (
__pycache__) written during package scripts. We purge it and let it regenerate. - A log line in
/var/log/apt/history.log, and the log directory generally. Removed.
After that the root filesystem tarball hash is stable between runs. The final disk image still differs by partition UUIDs, so we set those explicitly from the snapshot date and image name.
What we have not solved
Kernel and initrd updates after first boot. An image is a point in time, and a machine that stays up for two years drifts from it. That is what runbooks are for, and it is why we think of the two products as one. Image for the baseline, runbook for everything after.
Written by Elena Kovac. Comments, corrections and arguments to elena.kovac@ansiblecloud.io.