Contents

Create Vagrant boxes with Packer and Ansible for libvirt

Contents

As you might have heard or read already, HashiCorp is about to deprecate HCP Vagrant: HCP Vagrant is in the process of being deprecated and limited features will be available from the community edition effective November 2, 2026.. The biggest impact for most people is most probably that the Vagrant Public Registry with all it’s public Vagrant boxes will go away. Not sure if someone will step up and provide an alternative.

I’m just hopping that this doesn’t mean that Vagrant will go away too sooner or later. While HashiCorp wasn’t part of IBM they had plans to migrate Vagrant from Ruby to Go. But haven’t heard anything since then about that migration anymore. That would have been really great as this Ruby dependencies always causing issues with basically every upgrade. Sometimes it’s really a nightmare.

I’m using Vagrant boxes to test my various Ansible roles and collections. Over the years I used various boxes with varying success. Some where quite usable, some caused problems quite often. Most of the time when I changed a role, tested it, and something was not working it was not the change itself not working but problems with the Vagrant box that changed in some unreliable way.

Without knowing that the public Vagrant boxes will be shut down I created some tooling to build these boxes on my own a while ago. This now becomes really handy with public Vagrant boxes going away as I don’t depend on them anymore. And they provide reliable builds. You can find the tooling here in my Github repo: Libvirt Vagrant boxes/images (Packer + Ansible).

As I’m on Linux (amd64 architecture) and using libvirt + KVM to install virtual machines the repo only builds Vagrant boxes for that architecture and for Vagrant libvirt provider. It builds the following Linux boxes:

  • Ubuntu: 22.04, 24.04, 26.04
  • Debian: 12, 13
  • Fedora: 42, 43, 44
  • Rocky Linux: 9, 10
  • AlmaLinux: 9, 10
  • Arch Linux
  • openSUSE Leap: 15.6, 16

If you are in need to replace a public Vagrant box this repository might help or get you started to create boxes on your own and maybe also for different CPU architectures. The repository contains extensive documentation how to use it.