From 914e2e473b40df4947178caca3ea4aff5fb86e2e Mon Sep 17 00:00:00 2001 From: rubenb Date: Tue, 21 Nov 2023 15:38:57 +0100 Subject: [PATCH] add playbook windows update --- windows-update_windows.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 windows-update_windows.yaml diff --git a/windows-update_windows.yaml b/windows-update_windows.yaml new file mode 100644 index 0000000..3fe6c9b --- /dev/null +++ b/windows-update_windows.yaml @@ -0,0 +1,31 @@ +- hosts: windows + ignore_unreachable: yes + serial: 1 + tasks: + # Check if there are missing updates + - block: + - name: Check for missing updates. + win_updates: state=searched + register: update_count + #Install missing updates only if at least one is missing + - block: + - name: Install missing updates. + win_updates: + category_names: '*' + #- Application + #- Connectors + #- DefinitionUpdates + #- DeveloperKits + #- FeaturePacks + #- Guidance + #- ServicePacks + #- Tools + #- UpdateRollups + #- CriticalUpdates + #- SecurityUpdates + log_path: C:\Win_Template_Patch.log + register: update_result + - name: Reboot, if needed. + win_reboot: + when: update_result.reboot_required + when: update_count.found_update_count|int >= 1 \ No newline at end of file