You can have multiple plays in a playbook so your playbook could look 
something like this.

- name: setup PS requirements on all hosts
  hosts: firsthost
  tasks:
  - name: install psexec
    win_chocolatey:
      name: sysinternal
      state: present


  - name: setup PS with psexec
    win_psexec:
      command: powershell.exe -File C:\temp\upgrade_script.ps1
      hostnames: '{{groups['windows']}}' # may need to find a way to 
exclude the current host, would need to play around with this
      username: username
      password: password
      priority: high


- name: run Ansible on all hosts
  hosts: windows
  tasks:
  - name: wait for the WinRM connection to come online
    wait_for_connection:


  - name: run whatever you want
    win_ping:


I haven't actually used this module before but I believe it is just a 
wrapper around the PSExec executable so it should work. Your upgrade script 
would need to handle the idempotency around skipping if PS is already v3.0 
and also to setup the WinRM listeners. In the end if these are new servers 
you are provisioning this stuff should be done in the bootstrapping/imaging 
process but if they are existing servers then you don't have too much 
choice.

Hopefully this helps.

Thanks

Jordan

-- 
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/89a5a0cc-47ba-405f-afa2-fd87a92b975f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to