Make the DNS service optional when installing Active Directory (#63440)

* Added install_dns option to the win_domain module.

* Added install_dns option to the win_domain_controller module.

* Updated version_added to devel branch version 2.10.

* Updates for ansible-test errors.

* Minor nits to docs
This commit is contained in:
philseeley 2019-11-12 15:53:51 +11:00 committed by Jordan Borean
parent 8b13836b1f
commit ca42cb2868
4 changed files with 19 additions and 1 deletions

View file

@ -34,6 +34,7 @@ $sysvol_path = Get-AnsibleParam -obj $params -name "sysvol_path" -type "path"
$create_dns_delegation = Get-AnsibleParam -obj $params -name "create_dns_delegation" -type "bool" $create_dns_delegation = Get-AnsibleParam -obj $params -name "create_dns_delegation" -type "bool"
$domain_mode = Get-AnsibleParam -obj $params -name "domain_mode" -type "str" $domain_mode = Get-AnsibleParam -obj $params -name "domain_mode" -type "str"
$forest_mode = Get-AnsibleParam -obj $params -name "forest_mode" -type "str" $forest_mode = Get-AnsibleParam -obj $params -name "forest_mode" -type "str"
$install_dns = Get-AnsibleParam -obj $params -name "install_dns" -type "bool" -default $true
# FUTURE: Support down to Server 2012? # FUTURE: Support down to Server 2012?
if ([System.Environment]::OSVersion.Version -lt [Version]"6.3.9600.0") { if ([System.Environment]::OSVersion.Version -lt [Version]"6.3.9600.0") {
@ -89,7 +90,7 @@ if (-not $forest) {
SafeModeAdministratorPassword=$sm_cred; SafeModeAdministratorPassword=$sm_cred;
Confirm=$false; Confirm=$false;
SkipPreChecks=$true; SkipPreChecks=$true;
InstallDns=$true; InstallDns=$install_dns;
NoRebootOnCompletion=$true; NoRebootOnCompletion=$true;
WhatIf=$check_mode; WhatIf=$check_mode;
} }

View file

@ -71,6 +71,12 @@ options:
type: str type: str
choices: [ Win2003, Win2008, Win2008R2, Win2012, Win2012R2, WinThreshold ] choices: [ Win2003, Win2008, Win2008R2, Win2012, Win2012R2, WinThreshold ]
version_added: '2.8' version_added: '2.8'
install_dns:
description:
- Whether to install the DNS service when creating the domain controller.
type: bool
default: yes
version_added: '2.10'
seealso: seealso:
- module: win_domain_controller - module: win_domain_controller
- module: win_domain_computer - module: win_domain_computer

View file

@ -105,6 +105,7 @@ $database_path = Get-AnsibleParam -obj $params -name "database_path" -type "path
$sysvol_path = Get-AnsibleParam -obj $params -name "sysvol_path" -type "path" $sysvol_path = Get-AnsibleParam -obj $params -name "sysvol_path" -type "path"
$read_only = Get-AnsibleParam -obj $params -name "read_only" -type "bool" -default $false $read_only = Get-AnsibleParam -obj $params -name "read_only" -type "bool" -default $false
$site_name = Get-AnsibleParam -obj $params -name "site_name" -type "str" -failifempty $read_only $site_name = Get-AnsibleParam -obj $params -name "site_name" -type "str" -failifempty $read_only
$install_dns = Get-AnsibleParam -obj $params -name "install_dns" -type "bool"
$state = Get-AnsibleParam -obj $params -name "state" -validateset ("domain_controller", "member_server") -failifempty $result $state = Get-AnsibleParam -obj $params -name "state" -validateset ("domain_controller", "member_server") -failifempty $result
@ -212,6 +213,9 @@ Try {
if ($site_name) { if ($site_name) {
$install_params.SiteName = $site_name $install_params.SiteName = $site_name
} }
if ($null -ne $install_dns) {
$install_params.InstallDns = $install_dns
}
try try
{ {
$null = Install-ADDSDomainController -NoRebootOnCompletion -Force @install_params $null = Install-ADDSDomainController -NoRebootOnCompletion -Force @install_params

View file

@ -70,6 +70,13 @@ options:
- If not set then the default path is C(%SYSTEMROOT%\SYSVOL). - If not set then the default path is C(%SYSTEMROOT%\SYSVOL).
type: path type: path
version_added: '2.5' version_added: '2.5'
install_dns:
description:
- Whether to install the DNS service when creating the domain controller.
- If not specified then the C(-InstallDns) option is not supplied to C(Install-ADDSDomainController) command,
see U(https://docs.microsoft.com/en-us/powershell/module/addsdeployment/install-addsdomaincontroller).
type: bool
version_added: '2.10'
seealso: seealso:
- module: win_domain - module: win_domain
- module: win_domain_computer - module: win_domain_computer