Foreman development setup with libvirt 2020

Thanks to dnsmasq DHCP Foreman plugin, development setup for provisioning can be little bit easier. After git checkout of Foreman core, Smart Proxy and Smart Proxy DHCP Dnsmasq plugin, perform creation of initial directory structure:

# mkdir /var/lib/libvirt/dnsmasq/foreman-default
# chown $DEVELOPER:dnsmasq /var/lib/libvirt/dnsmasq/foreman-default
# touch /var/lib/dnsmasq/foreman-default.leases
# chown $DEVELOPER:dnsmasq /var/lib/dnsmasq/foreman-default.leases
# mkdir /var/lib/dnsmasq/tftp
# chown $DEVELOPER:dnsmasq /var/lib/dnsmasq/tftp/
# setfacl -m u:$DEVELOPER:r-- /var/lib/libvirt/dnsmasq/default.conf

Copy PXELinux files, this will work also for Grub2 or iPXE:

# cp /usr/share/syslinux/*.{bin,c32,0} /var/lib/dnsmasq/tftp

Finally, change libvirt “default” network configuration in the following way. The difference between the default configuration are the following elements or attributes:

  • tftp
  • bootp
  • dnsmasq:options
  • xmlns:dnsmasq

    default 25fd4c6e-4d9e-45a6-b448-57900c3315f2

Restart libvirt network named “default” and you are good to go. Note in this setup I haven’t configured DNS, therefore unattended_url must be set to something like