Making a change using virt_net will act differently if the network is running, or inactive. If running, the change is made temporarily to the running network. If not running, the change is made to the config.
I believe this flag should in fact be set to libvirt.VIR_NETWORK_UPDATE_AFFECT_LIVE | libvirt.VIR_NETWORK_UPDATE_AFFECT_CONFIG by default, and possibly have an extra argument in the virt_net ansible module to change this behaviour.
SUMMARY
(copied from https://github.com/ansible/ansible/issues/64898)
Making a change using virt_net will act differently if the network is running, or inactive. If running, the change is made temporarily to the running network. If not running, the change is made to the config.
This is due to the
libvirt.VIR_NETWORK_UPDATE_AFFECT_CURRENT
flag being passed to the modify command at https://github.com/ansible/ansible/blob/b1360c0d943e50239c8f8bfb0c6ffb0feaad4e6d/lib/ansible/modules/cloud/misc/virt_net.py#L245As per https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkUpdateFlags this flag will "affect live if network is active, config if it's not active"
I believe this flag should in fact be set to
libvirt.VIR_NETWORK_UPDATE_AFFECT_LIVE | libvirt.VIR_NETWORK_UPDATE_AFFECT_CONFIG
by default, and possibly have an extra argument in the virt_net ansible module to change this behaviour.ISSUE TYPE
COMPONENT NAME
virt_net
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION