Home

Awesome

packer-builder-vmm

This is an OpenBSD VMM plugin for packer.

Installation

Execute the following command to install this plugin:

go get -u github.com/prep/packer-builder-vmm/cmd/packer-builder-vmm

Then move the newly built ~/go/bin/packer-builder-vmm binary to either ~/.packer.d/plugins or in place it in the directory you're going to run packer build from.

Notes

Example

This project has a couple of example packer configurations in the examples directory, like an Alpine Linux 3.8.1 installation and an OpenBSD 6.4 installation. Let's demonstrate what building the OpenBSD example looks like. First, issue the packer build command:

packer build examples/openbsd.json

The build process will create a logfile of what's happening behind the scenes, that you can follow by tailing it in another terminal. This is useful to detect timing errors (commands being issued too soon, etc) or configuration errors in your build script:

tail -f output-vmm/openbsd-example.log

When the build is done, packer should have left you a output-vmm/openbsd-example.qcow2 bootable disk image of a clean OpenBSD installation, which you can immediately boot:

vmctl start openbsd-example -cL -d output-vmm/openbsd-example.qcow2

Hint

If you've built a qcow2 image as was done in the above example, you can also use it as a read-only base for a new image that only contains the changes written by the VM:

vmctl create new-vm.qcow2 -b output-vmm/openbsd-example.qcow2
vmctl start new-vm -cL -d new-vm.qcow2