Skip to content

prep/packer-builder-vmm

Repository files navigation

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

  • It is assumed that you run packer as an unprivileged user and that doas can be used to start vmctl.
  • 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.

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

Releases

No releases published

Packages

No packages published

Languages