From 8d78edd9dd4e5abe975325b9e80e8daa497f1aa2 Mon Sep 17 00:00:00 2001 From: L3D Date: Sat, 31 Dec 2022 22:58:55 +0100 Subject: [PATCH] try to improve updating --- tasks/activate.yml | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/tasks/activate.yml b/tasks/activate.yml index fd10ac2..88d8b24 100644 --- a/tasks/activate.yml +++ b/tasks/activate.yml @@ -35,14 +35,41 @@ ansible.builtin.debug: var: ansible_os_license_status -- name: Install all security updates with automatic reboots +- name: Install Windows Updates ansible.windows.win_updates: category_names: - SecurityUpdates - CriticalUpdates - reboot: true + - UpdateRollups + - Updates + reboot: false + register: res -- name: Install all critical and rollup updates without a scheduled task +- name: Host is rebooting in 15 sec!! + ansible.windows.win_reboot: + pre_reboot_delay: 15 + when: + - res.reboot_required | bool + +- name: Post Update Check ansible.windows.win_updates: category_names: + - Application + - Connectors + - CriticalUpdates + - DefinitionUpdates + - DeveloperKits + - FeaturePacks + - Guidance + - SecurityUpdates + - ServicePacks + - Tools - UpdateRollups + - Updates + register: res + +- name: Host is rebooting in 15 sec!! + ansible.windows.win_reboot: + pre_reboot_delay: 15 + when: + - res.reboot_required | bool