how to wait for a windows machine to come up after rebooting?

510 views
Skip to first unread message

Sharwari Phadnis

unread,
Apr 15, 2016, 9:07:19 AM4/15/16
to Ansible Project
I am trying to reboot a windows machine and I want to wait for it come up. I tried the following playbook:

---
- hosts: windows
  tasks:
     - name: Reboot windows
       raw: shutdown /r /f
   
     - name: ping windows machine until it comes up
       action: win_ping
       register: result
       until: result.rc == 0
       retries: 30
       delay: 20
 
But, it is not working somehow. Is there any other way I can reboot the windows 10 machine and wait for it come up ?

J Hawkesworth

unread,
Apr 15, 2016, 1:28:02 PM4/15/16
to Ansible Project
There is a win_reboot role on Galaxy which will do this for you.

Also there is a Pull Request (not yet merged) for a win_reboot action here https://github.com/ansible/ansible/pull/15314

If you can help out with testing the reboot action that would make it more likely to get included in the next release of Ansible.

Hope this helps,

Jon
Reply all
Reply to author
Forward
0 new messages