The win_updates module will give a reboot_required: True return value when 
one is required. With that information you can register the task and then 
have a follow up win_reboot task when reboot_required: True.   See below 
for how to accomplish this.


- name: Install Windows Updates
  win_updates:
  register: updates

- name: Reboot after installing updates
  win_reboot:
  when: updates.reboot_required




On Monday, September 25, 2017 at 7:52:36 AM UTC-5, Sunil Kumar wrote:
>
> Hi Guys,
>
> I am very new to Ansible. We are trying to automate windows montly 
> patches. But our playbook keep on fail when there is a update which 
> requires a reboot. How to handle intellegent system reboot only if it 
> requires.
>
> I have a very big doubt that once reboot is triggered the winrm connection 
> will lost or it will wait for some seconds. If the connection is lost then 
> we are planning to handle that with pause option but i need code logic it 
> should pause the execution process only if rebooted is done.
>
> Please help me.
>
> Thanks,
> Sunil.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/beba6d54-57a4-4ce0-94e0-b38fe2c71cea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to