Skip to content

Instantly share code, notes, and snippets.

@trondhindenes
Created June 19, 2015 13:12
Show Gist options
  • Save trondhindenes/a6e24ee2b5b59454be99 to your computer and use it in GitHub Desktop.
Save trondhindenes/a6e24ee2b5b59454be99 to your computer and use it in GitHub Desktop.
Ansible play to wait for Windows nodes to come online
---
- name: Wait for windows reboot
hosts: windows
gather_facts: False
tasks:
- shell: 'curl -s -f -k --header "Content-Type: application/soap+xml;charset=UTF-8" --header "WSMANIDENTIFY: unauthenticated" https://{{ ansible_ssh_host }}:{{ ansible_ssh_port }}/wsman --data "<s:Envelope xmlns:s=http://www.w3.org/2003/05/soap-envelope xmlns:wsmid=http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd><s:Header/><s:Body><wsmid:Identify/></s:Body></s:Envelope>" || true'
register: result2
until: result2.stdout.find("Microsoft Corporation") != -1
retries: 30
delay: 10
delegate_to: 127.0.0.1
changed_when: False
- name: Debug the stuffs
hosts: windows
tasks:
- debug:
var: ansible_hostname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment