Update win-updates-troubleshooting.yaml

This commit is contained in:
2025-08-14 09:07:39 +00:00
parent 34d1b93288
commit 1688ead9c8

View File

@@ -156,29 +156,24 @@
- (kb_numbers is not defined or kb_numbers | length == 0)
# ---- 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
delegate_to: localhost
delegate_facts: true
set_fact:
failed_hosts_list: []
- 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] }}"
failed_hosts_list: "{{ (failed_hosts_list | default([])) + [item] }}"
loop: "{{ ansible_play_hosts_all }}"
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
delegate_to: localhost
delegate_facts: true
vars:
_fails: "{{ hostvars['localhost'].failed_hosts_list | default([]) }}"
set_fact:
any_patch_failed: "{{ (failed_hosts_list | length) > 0 }}"
failed_hosts_csv: "{{ failed_hosts_list | join(', ') if failed_hosts_list | length > 0 else 'None' }}"
any_patch_failed: "{{ (_fails | length) > 0 }}"
failed_hosts_csv: "{{ _fails | join(', ') if (_fails | length) > 0 else 'None' }}"
# ------------------------------------------------------------------------------