Hello,
I am using Ansible to update templated VM machines with correct networking. My inventory contains the templated hosts [nos5] and the deployed host [nos6]. It should be noted that the interface I am changing is the one I’m using in Ansible .
The Ansible playbook successfully updates the ifcfg-eth0 file and restarts the network. However, it hangs for about 1-2 minutes before returning a failure code.
fatal: [nos5]: FAILED! => {“changed”: false, “failed”: true, “invocation”: {“module_name”: “command”}, “module_stderr”: “”, “module_stdout”: “\r\n”, “msg”: “MODULE FAILURE”, “parsed”: false}
The tasks I’m executing are as follows.
name: Update Networking for NOS
lineinfile:
dest: /etc/sysconfig/network-scripts/ifcfg-eth0
regexp: “^IPADDR”
line: “IPADDR=10.157.{{ VDC_Number }}.100”
when: target_vm == “NOS”
register: network_nos_okname: Bounce the interface
shell: ifdown eth0; ifup eth0
when: target_vm == “NOS” and network_nos_ok is defined
The starting IP is 10.157.5.100, and the changed IP is 10.157.6.100.
Is there a way to make this happen without the excessive delaty and report success?