Your server may still be in the process of shutting down when your "wait_for" is executed. So the wait_for could make a connection and think the server is back up when it is actually on its way down...
Try setting the delay parameter in the wait_for (e.g to 15) to ensure that the server is down/rebooting before waif_for starts checking. John On Monday, 10 November 2014 02:33:55 UTC, Patrick Galbraith wrote: > > Hi all! > > We've been working on a playbook that does a dist upgrade and then > performs a reboot. This has been problematic and results in a failure > return status that sometimes means it worked and sometimes not. What is the > trick to reboots -- being able to smoothly reconnect after a reboot signal? > > --- > - name: reboot the server > command: shutdown -r now "Ansible updates triggered" > async: 0 > poll: 0 > ignore_errors: true > tags: > - reboot > > - name: waiting for server to come back > sudo: false > local_action: > > wait_for: > host: {{ inventory_hostname }} > timeout: 300 > delay: 0 > port: 22 > state: started > tags: > - reboot > > Is there a technique that is commonly used that results in better plays > that result in success? > > Regards, > > Patrick > -- 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 post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ec54827e-539c-4a8e-afe1-8ce704ea3208%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.