- 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
ERROR! 'until' is not a valid attribute for a Block
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/792346e5-85b6-4b00-a345-9edd1bb2934a%40googlegroups.com.--
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+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
--
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+unsubscribe@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/alpine.LRH.2.20.1701082057130.19483%40pikachu.3ti.be.
---- hosts: localhost ignore_errors: true# gather_facts: true
tasks: - shell: ansible-playbook wu.yml register: results until: "'\"found_update_count\": 0' in results.stdout" retries: 5
---- hosts: bunch_of_hosts ignore_errors: true #gather_facts: true
tasks: - block:
- name: search wu win_updates: category_names:
- CriticalUpdates - SecurityUpdates - UpdateRollups
state: - searched log_path: - c:/temp/ansible_wu.txt register: searched
- debug: var=searched
- name: install wu win_updates: category_names:
- CriticalUpdates - SecurityUpdates - UpdateRollups
state: - installed log_path: - c:/temp/ansible_wu.txt
when: searched.found_update_count > 0 register: installed - debug: var=installed
- name: reboot win_reboot: pre_reboot_delay_sec: 0 test_command: whoami reboot_timeout_sec: 300 when: installed.reboot_required
register: rebooted - debug: var=rebooted
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/alpine.LRH.2.20.1701082057130.19483%40pikachu.3ti.be.
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2ebf7ecd-8da0-4b1d-99ba-f886721a9d2c%40googlegroups.com.To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
---- hosts: windows_servers ignore_errors: true gather_facts: false
tasks: - name: inner playbook include: update-windows.yml until: 'searched_inner.found_update_count > 0' retries: 10 - debug: var=searched_inner
- name: search wu win_updates: category_names:
- CriticalUpdates - SecurityUpdates - UpdateRollups
state: - searched log_path: - c:/temp/ansible_wu.txt register: searched
- set_fact: searched_inner: "{{ searched }}"
[root@ansiblecm more_tires]# ansible-playbook main.yml --limit try
PLAY [windows_servers] *********************************************************
TASK [search wu] *************************************************************** [WARNING]: Module invocation had junk after the JSON data:
changed: [try]
TASK [set_fact] ****************************************************************ok: [try]
TASK [debug] *******************************************************************ok: [try] => { "searched_inner": { "changed": true, "found_update_count": 189, "installed_update_count": 0, "reboot_required": false, "updates": { "0025cccd-6122-483a-a646-dd3ea3ff861f": { "id": "0025cccd-6122-483a-a646-dd3ea3ff861f", "installed": false, "kb": [ "3179574" ], "title": "Update for Windows Server 2012 R2 (KB3179574)" }, ...
...
...
PLAY RECAP *********************************************************************try : ok=3 changed=1 unreachable=0 failed=0
Playbook run took 0 days, 0 hours, 2 minutes, 4 seconds
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2ebf7ecd-8da0-4b1d-99ba-f886721a9d2c%40googlegroups.com.
---- hosts: - localhost
tasks: - name: "Performing tasks before windows updates." debug: msg="blah blah"
- name: "Calling playbook that will install windows updates." include: inner-taskbook.yml with_sequence: start=1 end=100 loop_control: loop_var: main_item
- name: "Performing tasks after windows updates." debug: msg="blah blah blah"
- name: "Performing Windows updates, printing loop counter for reference {{ main_item }}." debug: var=main_item
- name: "Task to determine whether further updates are needed." set_fact: updates_needed: "{{ 10|random }}"
- name: "Ending play if no further updates needed. {{ updates_needed }}" meta: end_play when: updates_needed == '1'
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d109f167-b52d-40f4-bc34-7c7bc9f5ffcd%40googlegroups.com.To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.