From 6b4fdecedd0c1002c19bfed4eaf4a4107e26458c Mon Sep 17 00:00:00 2001 From: "mhorak@totalservice.cz" Date: Mon, 18 Aug 2025 14:35:12 +0200 Subject: [PATCH] 4 --- patch-dc-controllers.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/patch-dc-controllers.yaml b/patch-dc-controllers.yaml index 64b3e65..46019d7 100644 --- a/patch-dc-controllers.yaml +++ b/patch-dc-controllers.yaml @@ -1,23 +1,23 @@ --- -- name: Patch Domain Controllers via SYSTEM scheduled task +- name: Patch DCs via SYSTEM scheduled task hosts: domain_controllers gather_facts: no tasks: - name: Start the SYSTEM patch task - community.windows.win_scheduled_task: - name: "Patching-windows-task" - state: started + ansible.windows.win_powershell: + script: | + Start-ScheduledTask -TaskName 'Patching-windows-task' - name: Wait until the task finishes community.windows.win_scheduled_task_stat: name: "Patching-windows-task" register: patch_task - until: patch_task.task.state in ['Ready','Disabled'] # Task finished - retries: 180 # check for up to 3 hours - delay: 60 # wait 60s between checks + until: patch_task.task.state in ['Ready','Disabled'] # finished + retries: 180 + delay: 60 - - name: Reboot DC if needed (belt & suspenders) + - name: Reboot if needed ansible.windows.win_reboot: reboot_timeout: 3600 when: patch_task.task.state == 'Ready' \ No newline at end of file