Hi,

I'm using win_updates module to carry out windows patching and it works 
pretty good.
Sometime, updates have dependencies and multiple playbook execution 
required.

I was thinking, if possible, to loop the playbook until "found_update_count 
> 0" without the need of running ansible-playbook multiple time after each 
finish.

My playbook looks like this:

- hosts: win_server_1
  ignore_errors: true
  gather_facts: true

  tasks:
    - name: search wu
      win_updates:
        category_names:
          - UpdateRollups
          - CriticalUpdates
          - SecurityUpdates
        state:
          - searched
        log_path:
          - c:/temp/ansible_wu.txt
      register: searched
    
    - name: install wu
      win_updates:
        category_names:
          - UpdateRollups
          - CriticalUpdates
          - SecurityUpdates
        state:
          - installed
        log_path:
          - c:/temp/ansible_wu.txt
      register: installed
      when: searched.found_update_count > 0
    
    - name: reboot
      win_reboot:
        pre_reboot_delay_sec: 0
        test_command: whoami
        reboot_timeout_sec: 300
      when: installed.reboot_required = 'true'
      register: reboot


I cant figure out how to put this in playbook by myself, seeking for some 
guidance.

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 [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/ca0172e3-d668-4316-a4a3-47586704e680%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to