-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathpatching_windows.yml
executable file
·48 lines (44 loc) · 1.38 KB
/
patching_windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
- name: Windows Patches
hosts: all
vars:
categories:
- SecurityUpdates
- CriticalUpdates
tasks:
- block:
- name: apply windows updates
win_updates:
category_name: "{{ categories | default([]) }}"
blacklist: "{{ blacklist | default([]) }}"
whitelist: "{{ whitelist | default([]) }}"
reboot: no
register: patching_output
- name: reboot if necessary
win_reboot:
when:
- patching_output.reboot_required
- reboot_method == 'auto'
- patch_window == reboot_window
- name: check missing updates
win_updates:
category_name: "{{ categories | default([]) }}"
state: searched
register: missing_output
- name: warn if missed updates
debug:
msg: "Yo yo yo - We missed some ( {{ missing_output.found_update_count }} updates ) "
when:
- missing_output.found_update_count is defined
- missing_output.found_update_count > 0
- name: list of updates not installed (skipped)
debug:
msg: "{{ item }}"
loop:
- "{{ missing_output.updates }}"
when:
- missing_output.found_update_count is defined
- missing_output.found_update_count > 0
- missing_output.updates is defined
when:
- patch_enabled
- patch_method == 'auto'