Hi, The issue is that device is online and reachable even before the timeout of 300 secs is reached. Yet this command doesn't work.
Regards, Vikram On Monday, 22 February, 2021 at 8:21:48 pm UTC+5:30 ico....@gmail.com wrote: > wait_for have timeout, by default 300s. > > wait_for: > timeout: 800 > > On Saturday, February 20, 2021 at 3:57:18 PM UTC+1 Vikram S wrote: > >> Hi, >> >> I am writing a script to upgrade IOS in cisco router. After i give reload >> command, the next task to be executed is the below one. >> This part of the playbook basically waits for the device to be reachable >> again on port 22. I have also added a delay of 600 seconds before it starts >> trying. The playbook will not progress until this device is reachable. >> However this TASK doesn't execute as expected. I am getting an error. Am >> i doing something wrong or overlooking anything? (username, password >> and host IP is defined in invetory file) >> >> - name: WAIT 30 MINUTES FOR DEVICE TO COME ONLINE >> wait_for: >> host: "{{ inventory_hostname }}" >> port: 22 >> delay: 600 >> delegate_to: localhost >> >> >> >> root@NetworkAutomation-2:~# ansible-playbook sample28.yaml >> >> PLAY [PLAYBOOK FOR UPGRADE TASKS] >> ****************************************************************************************************** >> >> TASK [WAIT 30 MINUTES FOR DEVICE TO COME ONLINE] >> *************************************************************************************** >> >> *fatal: [R1 -> localhost]: FAILED! => {"changed": false, "elapsed": 300, >> "msg": "Timeout when waiting for R1:22"}* >> >> PLAY RECAP >> ***************************************************************************************************************************** >> R1 : ok=0 changed=0 unreachable=0 >> failed=1 skipped=0 rescued=0 ignored=0 >> >> >> Thanks, >> Vikram >> > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3bc77457-fe01-4b3b-82ef-f3edbcec0f31n%40googlegroups.com.