Update win-updates-troubleshooting.yaml
This commit is contained in:
@@ -156,29 +156,24 @@
|
|||||||
- (kb_numbers is not defined or kb_numbers | length == 0)
|
- (kb_numbers is not defined or kb_numbers | length == 0)
|
||||||
|
|
||||||
# ---- Aggregate & publish facts to localhost for next play ----
|
# ---- Aggregate & publish facts to localhost for next play ----
|
||||||
- name: Aggregate per-host patch failures and publish to localhost
|
- name: Collect failed hosts (no extract filter; safe default)
|
||||||
run_once: true
|
run_once: true
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
delegate_facts: true
|
delegate_facts: true
|
||||||
set_fact:
|
set_fact:
|
||||||
failed_hosts_list: []
|
failed_hosts_list: "{{ (failed_hosts_list | default([])) + [item] }}"
|
||||||
|
|
||||||
- name: Collect failed hosts (no extract filter)
|
|
||||||
run_once: true
|
|
||||||
delegate_to: localhost
|
|
||||||
delegate_facts: true
|
|
||||||
set_fact:
|
|
||||||
failed_hosts_list: "{{ failed_hosts_list + [item] }}"
|
|
||||||
loop: "{{ ansible_play_hosts_all }}"
|
loop: "{{ ansible_play_hosts_all }}"
|
||||||
when: hostvars[item].patch_failed_host | default(false)
|
when: hostvars[item].patch_failed_host | default(false)
|
||||||
|
|
||||||
- name: Publish aggregate flags to localhost
|
- name: Publish aggregate flags to localhost (safe even if none failed)
|
||||||
run_once: true
|
run_once: true
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
delegate_facts: true
|
delegate_facts: true
|
||||||
|
vars:
|
||||||
|
_fails: "{{ hostvars['localhost'].failed_hosts_list | default([]) }}"
|
||||||
set_fact:
|
set_fact:
|
||||||
any_patch_failed: "{{ (failed_hosts_list | length) > 0 }}"
|
any_patch_failed: "{{ (_fails | length) > 0 }}"
|
||||||
failed_hosts_csv: "{{ failed_hosts_list | join(', ') if failed_hosts_list | length > 0 else 'None' }}"
|
failed_hosts_csv: "{{ _fails | join(', ') if (_fails | length) > 0 else 'None' }}"
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user