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