mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
win_domain modules: ensure Netlogon service is still running after promotion (#43703)
This commit is contained in:
parent
8eaebf86b6
commit
7b1cc11685
3 changed files with 28 additions and 1 deletions
|
@ -75,6 +75,17 @@ If(-not $forest) {
|
|||
$iaf = Install-ADDSForest @install_forest_args
|
||||
|
||||
$result.reboot_required = $iaf.RebootRequired
|
||||
|
||||
# The Netlogon service is set to auto start but is not started. This is
|
||||
# required for Ansible to connect back to the host and reboot in a
|
||||
# later task. Even if this fails Ansible can still connect but only
|
||||
# with ansible_winrm_transport=basic so we just display a warning if
|
||||
# this fails.
|
||||
try {
|
||||
Start-Service -Name Netlogon
|
||||
} catch {
|
||||
Add-Warning -obj $result -message "Failed to start the Netlogon service after promoting the host, Ansible may be unable to connect until the host is manually rebooting: $($_.Exception.Message)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,20 @@ Try {
|
|||
}
|
||||
$install_result = Install-ADDSDomainController -NoRebootOnCompletion -Force @install_params
|
||||
|
||||
Write-DebugLog "Installation completed, needs reboot..."
|
||||
Write-DebugLog "Installation complete, trying to start the Netlogon service"
|
||||
# The Netlogon service is set to auto start but is not started. This is
|
||||
# required for Ansible to connect back to the host and reboot in a
|
||||
# later task. Even if this fails Ansible can still connect but only
|
||||
# with ansible_winrm_transport=basic so we just display a warning if
|
||||
# this fails.
|
||||
try {
|
||||
Start-Service -Name Netlogon
|
||||
} catch {
|
||||
Write-DebugLog "Failed to start the Netlogon service: $($_.Exception.Message)"
|
||||
Add-Warning -obj $result -message "Failed to start the Netlogon service after promoting the host, Ansible may be unable to connect until the host is manually rebooting: $($_.Exception.Message)"
|
||||
}
|
||||
|
||||
Write-DebugLog "Domain Controller setup completed, needs reboot..."
|
||||
}
|
||||
}
|
||||
member_server {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue