vm image builder

This repo contains a almost-ready-to-use Debian VM image builder. A nixos version can be found in this branch.

Quickstart

By default, the image has a functional cloud-init environment and a ssh server.

Running locally

The runner script allows you to quickly run the image locally:

./run.sh -i test.qcow2

you should be able to login locally:

ssh root@localhost -p50022

Uploading to a cloud provider

The qcow2 format is supported by many cloud providers as is. During boot, the image will use any cloud-init configuration available (ssh keys, network configuration, etc).

Personally, I like to shrink the image to the smallest possible size before uploading it:

$ virt-sparsify test.qcow2 test-sparse.qcow2 # you might need to run this as root

$ pigz test-sparse.qcow2

I use do-image-uploader to upload my images to DigitalOcean:

$ export DO_API_TOKEN=$(pass show do-tokens/personal)
$ do-image-uploader --image-file=test-sparse.qcow2.gz --region=fra1 --name=test-image --wait-until-available

Customizing

The last configuration step runs the post-install script. By default, this script runs the ansible ansible playbook.