Hey Sunil

You should be using the win_reboot module to handle updates. It reboots the 
server and waits for it to come back online so it should be seemless and 
won't continue until it is ready for another task. Your playbook would look 
something like this

- name: install updates
  hosts: windows
  tasks:
  - win_updates:
      categories: CriticalUpdates
      state: installed
    register: update_result


  - win_reboot:
    when: update_result.reboot_required


  - name: second round of updates
    win_updates:
      categories: CriticalUpdates
      state: installed
    register: update_result


  - win_reboot:
    when: update_result.reboot_required


Thanks

-- 
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/8d7359e2-e920-4ff8-8098-683c94523254%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to