Vagrant with libvirt - fekoch/EvaP GitHub Wiki

Setup for Fedora

https://developer.fedoraproject.org/tools/vagrant/vagrant-libvirt.html

  • install vagrant + libvirt driver
  • enable libvirtd
  • enable virtnetworkd

Custom Vagrant Libvirt Config

To use libvirt an additional Configuration for the provider is needed.

First, add a custom "root" Vagrantfile in ~/.vagrant.d/Vagrantfile that loads project specific, non-versioned overrides from <project-dir>/.Vagrantfile.local:

# ~/vagrant.d/Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Load local vagrantfile

Vagrant.configure("2") do |config|

  if File.exist?(".Vagrantfile.local") then
    eval(IO.read(".Vagrantfile.local"), binding)
  end
end

In the EvaP Folder add the overriding code:

# EvaP/.Vagrantfile.local
config.vm.provider :libvirt do |l,override|
  override.vm.box = "cloud-image/ubuntu-22.04"
  l.memory = 2048
  l.cpus = 4
  override.vm.provision "shell", path: "deployment/provision_vagrant_vm.sh"
  override.vm.allowed_synced_folder_types = ["sshfs"]
end