diff options
author | Dag Wieers <dag@wieers.com> | 2017-08-24 14:14:14 +0200 |
---|---|---|
committer | Jordan Borean <jborean93@gmail.com> | 2017-08-24 08:14:14 -0400 |
commit | d830186e27dd87091cb50d3f73df2b74bc83ddb5 (patch) | |
tree | 18bcc30683afc099ec64d6acb4eab908b5dd9e06 | |
parent | d8429a69c59e0f6bf3a2d28b9f720b7e1790d27d (diff) | |
download | ansible-d830186e27dd87091cb50d3f73df2b74bc83ddb5.tar.gz |
Fix the reboot_required return value (#28579)
As reported in #28565
-rw-r--r-- | lib/ansible/modules/windows/win_domain_membership.ps1 | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/ansible/modules/windows/win_domain_membership.ps1 b/lib/ansible/modules/windows/win_domain_membership.ps1 index ca37608882..d19aa46d5c 100644 --- a/lib/ansible/modules/windows/win_domain_membership.ps1 +++ b/lib/ansible/modules/windows/win_domain_membership.ps1 @@ -235,6 +235,9 @@ Try { } $join_result = Join-Domain @join_args + + # this change requires a reboot + $result.reboot_required = $true } ElseIf(-not $hostname_match) { # domain matches but hostname doesn't, just do a rename Write-DebugLog ("domain matches, setting hostname to {0}" -f $hostname) @@ -247,10 +250,13 @@ Try { } $rename_result = Rename-Computer @rename_args + + # this change requires a reboot + $result.reboot_required = $true + } Else { + # no change is needed } - # all these changes require a reboot - $result.reboot_required = $true } Else { Write-DebugLog "check mode, exiting early..." @@ -267,11 +273,15 @@ Try { If(-not $workgroup_match) { Write-DebugLog ("setting workgroup to {0}" -f $workgroup_name) $join_wg_result = Join-Workgroup -workgroup_name $workgroup_name -domain_admin_user $domain_admin_user -domain_admin_password $domain_admin_password + + # this change requires a reboot $result.reboot_required = $true } If(-not $hostname_match) { Write-DebugLog ("setting hostname to {0}" -f $hostname) $rename_result = Rename-Computer -NewName $hostname + + # this change requires a reboot $result.reboot_required = $true } } |