From b67f713c8f2b358f51702e50de0ca45501abf9b7 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 31 Oct 2025 01:58:57 +0100 Subject: [PATCH] Set the libvirt management domain This makes sure the domain is set when the management domain is created, which makes libvirt configure dnsmasq as a proper DNS server. This can be used together with systemd-resolved on the host to look up guest IPs. It also configures Vagrant in CI with DNS set up to utilize this. --- .github/workflows/test.yml | 2 ++ Vagrantfile | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a2d71a46..d0ad71cd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,6 +55,8 @@ jobs: python-version: '3.12' - name: Setup libvirt for Vagrant uses: voxpupuli/setup-vagrant@v0 + with: + configure_dns: true - name: Install Ansible run: pip install --upgrade ansible-core - name: Setup environment diff --git a/Vagrantfile b/Vagrantfile index d89ea60f..2f9f71c1 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,3 +1,5 @@ +DOMAIN = 'example.com'.freeze + Vagrant.configure("2") do |config| config.vm.box = "centos/stream9" config.vm.synced_folder ".", "/vagrant" @@ -8,12 +10,13 @@ Vagrant.configure("2") do |config| end config.vm.define "quadlet" do |override| - override.vm.hostname = "quadlet.example.com" + override.vm.hostname = "quadlet.#{DOMAIN}" override.vm.provider "libvirt" do |libvirt, provider| libvirt.memory = 10240 libvirt.cpus = 4 libvirt.machine_virtual_size = 30 + libvirt.management_network_domain = DOMAIN end override.vm.provision('disk_resize', type: 'ansible') do |ansible_provisioner| @@ -22,10 +25,11 @@ Vagrant.configure("2") do |config| end config.vm.define "client" do |override| - override.vm.hostname = "client.example.com" + override.vm.hostname = "client.#{DOMAIN}" override.vm.provider "libvirt" do |libvirt, provider| libvirt.memory = 1024 + libvirt.management_network_domain = DOMAIN end end end