This is an OpenBSD VMM plugin for packer.
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.
- It is assumed that you run
packer
as an unprivileged user and thatdoas
can be used to startvmctl
. - For now, instances will only be started with a local network interface. The ability to attach a network interface to a virtual switch will be added later.
- The HTTP server, provisioning and post-processors are current unsupported, so everything has to be packed into the
boot_command
. - The Alpine example needs VM networking to be set up for local interfaces. The vmctl manpage section about local interfaces has some examples on getting that working.
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
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