I’m moving some packer builds to local infrastructure running QEMU (managed by libvirt)
The build host has multiple networks associated with it defined by libvirt.
WIthin the packer QEMU parameters there are options to set the spec of the virtual machine, including network device, name, network device type etc, which are great, but if you’re running on a host with multiple network’s defined, how to do configure the packer definition to provision the virtual instance on a specific network ? if possible using a friendly name eg: Use_Network = lab2 but anything would be acceptable eg: Use_Network_Subnet = 192.168.0.0/24 which would then select the right network.
I can’t see a way to do this as part of packer directly, the only way I can see to do this (but I’ve not tested yet as they don’t seem a good option)
is to pass directly into the qemu options the network to use or to configure libvirt to default to a network for all builds, but this isn’t great if you’re using different networks for different builds.
Any advice or guidance on how to approach this better ?