-
Notifications
You must be signed in to change notification settings - Fork 23
/
check_windows_updates_with_report.yml
executable file
·55 lines (48 loc) · 1.4 KB
/
check_windows_updates_with_report.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
49
50
51
52
53
54
55
- name: check Windows Updates
#hosts: '*windows_target'
hosts: all
vars:
wsus_server: 192.168.1.52
win_update_category_names:
- CriticalUpdates
- DefinitionUpdates
- SecurityUpdates
- UpdateRollups
- Updates
roles:
- configure-update
tasks:
- block:
- name: check for available updates
win_updates:
category_names: "{{ win_update_category_names }}"
state: searched
register: available_updates
rescue:
- block:
- name: reset windows update
include_role:
name: reset-windows-update
- name: check for available updates
win_updates:
category_names: "{{ win_update_category_names }}"
state: searched
register: available_updates
when:
- available_updates.msg is defined
- ('0x80244010' in available_updates.msg)
- name: failing due to an error
fail:
msg: "failing, see the error msg: {{ available_updates.msg }}"
when:
- available_updates.msg is defined
- ('0x80244010' not in available_updates.msg)
- name: generate report
#hosts: '*windows_target'
hosts: all
gather_facts: no
tasks:
- name: generate html report
include_role:
name: generate-update-report
run_once: yes