From af49627a08645051d85f0747f44f4622b35a75b3 Mon Sep 17 00:00:00 2001 From: Daniel-Sanchez-Fabregas <33929811+Daniel-Sanchez-Fabregas@users.noreply.github.com> Date: Mon, 27 Aug 2018 07:54:16 +0200 Subject: [PATCH] Module win_domain_computer fix delete computer with child (#44500) * Module win_domain_computer fix delete computer with child * add changelog fragment --- changelogs/fragments/44500-win_domain_computer.yaml | 2 ++ lib/ansible/modules/windows/win_domain_computer.ps1 | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/44500-win_domain_computer.yaml diff --git a/changelogs/fragments/44500-win_domain_computer.yaml b/changelogs/fragments/44500-win_domain_computer.yaml new file mode 100644 index 0000000000..4fbe62111b --- /dev/null +++ b/changelogs/fragments/44500-win_domain_computer.yaml @@ -0,0 +1,2 @@ +bugfixes: +- win_domain_computer - fixed deletion of computer active directory object that have dependent objects (https://github.com/ansible/ansible/pull/44500) diff --git a/lib/ansible/modules/windows/win_domain_computer.ps1 b/lib/ansible/modules/windows/win_domain_computer.ps1 index 9f766cb9a9..ed37aacfba 100644 --- a/lib/ansible/modules/windows/win_domain_computer.ps1 +++ b/lib/ansible/modules/windows/win_domain_computer.ps1 @@ -129,8 +129,9 @@ Function Add-ConstructedState($desired_state) { # ------------------------------------------------------------------------------ Function Remove-ConstructedState($initial_state) { Try { - Remove-ADComputer ` - -Identity $initial_state.name ` + Get-ADComputer $initial_state.name ` + | Remove-ADObject ` + -Recursive ` -Confirm:$False ` -WhatIf:$check_mode } Catch {