Open csmart opened 3 years ago
At the moment if a network exists it seems to fail rather than simply seeing the config as valid and moving on.
Aug 26 10:52:03 lshyp01 python3[1675106]: ansible-virt_net Invoked with command=define autostart=True name=default xml=
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<ip address='192.168.112.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.112.2' end='192.168.112.254'/>
</dhcp>
</ip>
</network>
uri=qemu:///system state=None
Aug 26 10:52:03 lshyp01 sudo[1675103]: pam_unix(sudo:session): session closed for user root Aug 26 10:52:03 lshyp01 sudo[1675128]: ansible : TTY=unknown ; PWD=/home/ansible ; USER=root ; COMMAND=/bin/sh -c echo BECOME-SUCCESS-zcugzxndrvngawiqdrrrdaypugebvqsp ; /usr/bin/python3 Aug 26 10:52:03 lshyp01 sudo[1675128]: pam_systemd(sudo:session): Cannot create session: Already running in a session or user slice Aug 26 10:52:03 lshyp01 sudo[1675128]: pam_unix(sudo:session): session opened for user root by (uid=0) Aug 26 10:52:03 lshyp01 python3[1675131]: ansible-virt_net Invoked with state=active name=default uri=qemu:///system command=None xml=None autostart=None Aug 26 10:52:03 lshyp01 libvirtd[1459219]: error creating bridge interface virbr0: File exists
Hmmm I'm not sure why the ansible is creating a bridge virbr0, that should happen automatically as it changes between VM starts and stops. The VM just needs to be told what libvirt network (or physical bridge) to connect to.
Can you please paste your inventory so I can take a look?
-c
Sorry I'll have to go back and set up the pipeline again and get back to you in a couple of days.
Ok my fault sorry, it was missing a dependency on the hypervisor
OK great, no worries! :+1:
Currently we only create or delete, but if we want to create and it already exists, then we could maybe use
modify
state instead to be able to make changes to the networks on the fly with ansible.