From c61f39f5fb9d373d338592f67679f62c39da0fb3 Mon Sep 17 00:00:00 2001 From: "mhorak@totalservice.cz" Date: Tue, 9 Sep 2025 09:39:26 +0200 Subject: [PATCH] version 3.5 --- patch-dc-controllers.yaml | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/patch-dc-controllers.yaml b/patch-dc-controllers.yaml index 7438fc1..ed4102e 100644 --- a/patch-dc-controllers.yaml +++ b/patch-dc-controllers.yaml @@ -1,20 +1,19 @@ ---- -- name: Patch DCs via JEA +- name: Patch Domain Controllers via JEA hosts: domain_controllers gather_facts: no - tasks: - - name: List available updates - ansible.windows.win_powershell: - Get-WindowsUpdate -MicrosoftUpdate -AcceptAll -IgnoreReboot - register: available_updates - changed_when: false + - name: Get available updates + win_shell: | + Invoke-Command -ConfigurationName DCMaintenance -ScriptBlock { Get-WindowsUpdate } - name: Install updates - ansible.windows.win_powershell: - Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -Verbose - register: install_result - - + win_shell: | + Invoke-Command -ConfigurationName DCMaintenance -ScriptBlock { Install-WindowsUpdate -AcceptAll -AutoReboot } + - name: Get update history + win_shell: | + Invoke-Command -ConfigurationName DCMaintenance -ScriptBlock { Get-WUHistory } + - name: Restart domain controller + win_shell: | + Invoke-Command -ConfigurationName DCMaintenance -ScriptBlock { Restart-Computer -Force }