Incus as a Vagrant replacement?

Vagrant is a nice tool to manage development and test environments. You describe in a Vagrantfile the VMs that you need, how they are connected (e.g. private network), and what to execute after they are brought up. Unfortunately, HashiCorp changed the Vagrant license to a non-free one. Also, Vagrant uses VirtualBox by default, which is not great (it can also use libvirt and kvm, but that adds complexity and slightly less supported).

Looking at Incus features, it looks like it has everything needed to be a Vagrant replacement, except that it does not provide a nice simple way to describe everything that should be provisioned in a single place. Typically, I’d like to be able to create a IncusFile in my development project that says that to create my dev environment, I need incus to:

  1. create a network
  2. create 2 containers with those images, and those IP addresses
  3. set up shared folders with the host so that I can access my code from the containers
  4. on the first container, run those commands
  5. on the second container, run those commands

And then run incus provision to provision everything, and when I’m done, run incus destroy to remove everything.

I saw that there’s a provider for terraform, but it looks a bit scary to bring all the complexity of terraform here.

I wonder if people already thought at that issue.

I use Incus profiles and cloud-init for that usecase. Together they can do nearly everything you described.

You can script the rest or reconsider Ansible and OpenTofu.

1 Like

If you want to script that without the complexity of Terraform, the simplest way would be to just transform your bullet list into a small shell script - if you don’t care about error handling and don’t get fancy, would probably around 5 to 10 lines…

Otherwise, if you want to have some kind of “official” framework but don’t want to pull in all of Terraform, I’d go with Ansible. There’s an LXD/Incus provider for that as well.