From e3d5dc0ed065de989318e8e1ccc10b574c57056b Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Mon, 17 Feb 2020 07:25:22 +1000 Subject: [PATCH] win_domain_controller: Added domain_log_path (#67448) --- .../fragments/win_domain_controller-log.yaml | 2 ++ .../modules/windows/win_domain_controller.ps1 | 4 ++++ .../modules/windows/win_domain_controller.py | 22 +++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 changelogs/fragments/win_domain_controller-log.yaml diff --git a/changelogs/fragments/win_domain_controller-log.yaml b/changelogs/fragments/win_domain_controller-log.yaml new file mode 100644 index 00000000000..323706967af --- /dev/null +++ b/changelogs/fragments/win_domain_controller-log.yaml @@ -0,0 +1,2 @@ +minor_changes: +- win_domain_controller - Added the ``domain_log_path`` to control the directory for the new AD log files location - https://github.com/ansible/ansible/issues/59348 diff --git a/lib/ansible/modules/windows/win_domain_controller.ps1 b/lib/ansible/modules/windows/win_domain_controller.ps1 index e399168eb2f..b96cbc60ba3 100644 --- a/lib/ansible/modules/windows/win_domain_controller.ps1 +++ b/lib/ansible/modules/windows/win_domain_controller.ps1 @@ -103,6 +103,7 @@ $domain_admin_password= Get-AnsibleParam -obj $params -name "domain_admin_passwo $local_admin_password= Get-AnsibleParam -obj $params -name "local_admin_password" $database_path = Get-AnsibleParam -obj $params -name "database_path" -type "path" $sysvol_path = Get-AnsibleParam -obj $params -name "sysvol_path" -type "path" +$domain_log_path = Get-AnsibleParam -obj $params -name "domain_log_path" -type "path" # TODO: Use log_path and alias domain_log_path once the log_path for debug logging option has been removed. $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 $install_dns = Get-AnsibleParam -obj $params -name "install_dns" -type "bool" @@ -206,6 +207,9 @@ Try { if ($database_path) { $install_params.DatabasePath = $database_path } + if ($domain_log_path) { + $install_params.LogPath = $domain_log_path + } if ($sysvol_path) { $install_params.SysvolPath = $sysvol_path } diff --git a/lib/ansible/modules/windows/win_domain_controller.py b/lib/ansible/modules/windows/win_domain_controller.py index 9bc4f2d11e6..603abc4efcd 100644 --- a/lib/ansible/modules/windows/win_domain_controller.py +++ b/lib/ansible/modules/windows/win_domain_controller.py @@ -63,6 +63,12 @@ options: - If not set then the default path is C(%SYSTEMROOT%\NTDS). type: path version_added: '2.5' + domain_log_path: + description: + - Specified the fully qualified, non-UNC path to a directory on a fixed disk of the local computer that will + contain the domain log files. + type: path + version_added: '2.10' sysvol_path: description: - The path to a directory on a fixed disk of the Windows host where the @@ -131,4 +137,20 @@ EXAMPLES = r''' state: domain_controller read_only: yes site_name: London + +- name: Promote server with custom paths + win_domain_controller: + dns_domain_name: ansible.vagrant + domain_admin_user: testguy@ansible.vagrant + domain_admin_password: password123! + safe_mode_password: password123! + state: domain_controller + sysvol_path: D:\SYSVOL + database_path: D:\NTDS + domain_log_path: D:\NTDS + register: dc_promotion + +- name: Reboot after promotion + win_reboot: + when: dc_promotion.reboot_required '''