mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
win_domain: added option to set database and sysvol path (#34333)
* win_domain: added param to set database and sysvol path * fixed up documentation to work with backslashes
This commit is contained in:
parent
dacd4c4a68
commit
38a31d3156
4 changed files with 48 additions and 5 deletions
|
@ -39,6 +39,8 @@ $parsed_args = Parse-Args $args -supports_check_mode $true
|
||||||
$check_mode = Get-AnsibleParam $parsed_args "_ansible_check_mode" -default $false
|
$check_mode = Get-AnsibleParam $parsed_args "_ansible_check_mode" -default $false
|
||||||
$dns_domain_name = Get-AnsibleParam $parsed_args "dns_domain_name" -failifempty $true
|
$dns_domain_name = Get-AnsibleParam $parsed_args "dns_domain_name" -failifempty $true
|
||||||
$safe_mode_admin_password = Get-AnsibleParam $parsed_args "safe_mode_password" -failifempty $true
|
$safe_mode_admin_password = Get-AnsibleParam $parsed_args "safe_mode_password" -failifempty $true
|
||||||
|
$database_path = Get-AnsibleParam $parsed_args "database_path" -type "path"
|
||||||
|
$sysvol_path = Get-AnsibleParam $parsed_args "sysvol_path" -type "path"
|
||||||
|
|
||||||
$forest = $null
|
$forest = $null
|
||||||
|
|
||||||
|
@ -72,6 +74,12 @@ If(-not $forest) {
|
||||||
InstallDNS=$true;
|
InstallDNS=$true;
|
||||||
NoRebootOnCompletion=$true;
|
NoRebootOnCompletion=$true;
|
||||||
}
|
}
|
||||||
|
if ($database_path) {
|
||||||
|
$install_forest_args.DatabasePath = $database_path
|
||||||
|
}
|
||||||
|
if ($sysvol_path) {
|
||||||
|
$install_forest_args.SysvolPath = $sysvol_path
|
||||||
|
}
|
||||||
|
|
||||||
$iaf = Install-ADDSForest @install_forest_args
|
$iaf = Install-ADDSForest @install_forest_args
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'supported_by': 'core'}
|
'supported_by': 'core'}
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r'''
|
||||||
module: win_domain
|
module: win_domain
|
||||||
short_description: Ensures the existence of a Windows domain.
|
short_description: Ensures the existence of a Windows domain.
|
||||||
version_added: 2.3
|
version_added: 2.3
|
||||||
|
@ -39,6 +39,18 @@ options:
|
||||||
description:
|
description:
|
||||||
- safe mode password for the domain controller
|
- safe mode password for the domain controller
|
||||||
required: true
|
required: true
|
||||||
|
database_path:
|
||||||
|
description:
|
||||||
|
- The path to a directory on a fixed disk of the Windows host where the
|
||||||
|
domain database will be created.
|
||||||
|
- If not set then the default path is C(%SYSTEMROOT%\NTDS).
|
||||||
|
version_added: '2.5'
|
||||||
|
sysvol_path:
|
||||||
|
description:
|
||||||
|
- The path to a directory on a fixed disk of the Windows host where the
|
||||||
|
Sysvol file will be created.
|
||||||
|
- If not set then the default path is C(%SYSTEMROOT%\SYSVOL).
|
||||||
|
version_added: '2.5'
|
||||||
author:
|
author:
|
||||||
- Matt Davis (@nitzmahone)
|
- Matt Davis (@nitzmahone)
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -116,6 +116,8 @@ $safe_mode_password= Get-AnsibleParam $param "safe_mode_password"
|
||||||
$domain_admin_user = Get-AnsibleParam $param "domain_admin_user" -failifempty $result
|
$domain_admin_user = Get-AnsibleParam $param "domain_admin_user" -failifempty $result
|
||||||
$domain_admin_password= Get-AnsibleParam $param "domain_admin_password" -failifempty $result
|
$domain_admin_password= Get-AnsibleParam $param "domain_admin_password" -failifempty $result
|
||||||
$local_admin_password= Get-AnsibleParam $param "local_admin_password"
|
$local_admin_password= Get-AnsibleParam $param "local_admin_password"
|
||||||
|
$database_path = Get-AnsibleParam $param "database_path" -type "path"
|
||||||
|
$sysvol_path = Get-AnsibleParam $param "sysvol_path" -type "path"
|
||||||
|
|
||||||
$state = Get-AnsibleParam $param "state" -validateset ("domain_controller", "member_server") -failifempty $result
|
$state = Get-AnsibleParam $param "state" -validateset ("domain_controller", "member_server") -failifempty $result
|
||||||
$log_path = Get-AnsibleParam $param "log_path"
|
$log_path = Get-AnsibleParam $param "log_path"
|
||||||
|
@ -203,8 +205,18 @@ Try {
|
||||||
|
|
||||||
$safe_mode_secure = $safe_mode_password | ConvertTo-SecureString -AsPlainText -Force
|
$safe_mode_secure = $safe_mode_password | ConvertTo-SecureString -AsPlainText -Force
|
||||||
Write-DebugLog "Installing domain controller..."
|
Write-DebugLog "Installing domain controller..."
|
||||||
|
$install_params = @{
|
||||||
$install_result = Install-ADDSDomainController -NoRebootOnCompletion -DomainName $dns_domain_name -Credential $domain_admin_cred -SafeModeAdministratorPassword $safe_mode_secure -Force
|
DomainName = $dns_domain_name
|
||||||
|
Credential = $domain_admin_cred
|
||||||
|
SafeModeAdministratorPassword = $safe_mode_secure
|
||||||
|
}
|
||||||
|
if ($database_path) {
|
||||||
|
$install_params.DatabasePath = $database_path
|
||||||
|
}
|
||||||
|
if ($sysvol_path) {
|
||||||
|
$install_params.SysvolPath = $sysvol_path
|
||||||
|
}
|
||||||
|
$install_result = Install-ADDSDomainController -NoRebootOnCompletion -Force @install_params
|
||||||
|
|
||||||
Write-DebugLog "Installation completed, needs reboot..."
|
Write-DebugLog "Installation completed, needs reboot..."
|
||||||
}
|
}
|
||||||
|
@ -252,4 +264,3 @@ Catch {
|
||||||
Throw
|
Throw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'supported_by': 'core'}
|
'supported_by': 'core'}
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r'''
|
||||||
module: win_domain_controller
|
module: win_domain_controller
|
||||||
short_description: Manage domain controller/member server state for a Windows host
|
short_description: Manage domain controller/member server state for a Windows host
|
||||||
version_added: 2.3
|
version_added: 2.3
|
||||||
|
@ -54,6 +54,18 @@ options:
|
||||||
choices:
|
choices:
|
||||||
- domain_controller
|
- domain_controller
|
||||||
- member_server
|
- member_server
|
||||||
|
database_path:
|
||||||
|
description:
|
||||||
|
- The path to a directory on a fixed disk of the Windows host where the
|
||||||
|
domain database will be created..
|
||||||
|
- If not set then the default path is C(%SYSTEMROOT%\NTDS).
|
||||||
|
version_added: '2.5'
|
||||||
|
sysvol_path:
|
||||||
|
description:
|
||||||
|
- The path to a directory on a fixed disk of the Windows host where the
|
||||||
|
Sysvol folder will be created.
|
||||||
|
- If not set then the default path is C(%SYSTEMROOT%\SYSVOL).
|
||||||
|
version_added: '2.5'
|
||||||
author:
|
author:
|
||||||
- Matt Davis (@nitzmahone)
|
- Matt Davis (@nitzmahone)
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Add table
Reference in a new issue