From 362442220cf875766dcb6ca0f1f9a24a9b20dd58 Mon Sep 17 00:00:00 2001 From: ogrechko Date: Wed, 6 May 2026 14:55:27 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20ansible/promote=5Fdc.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ansible/promote_dc.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/ansible/promote_dc.yml b/ansible/promote_dc.yml index 50b0173..bb10edd 100644 --- a/ansible/promote_dc.yml +++ b/ansible/promote_dc.yml @@ -8,7 +8,11 @@ ansible.windows.win_shell: | $size = Get-PartitionSupportedSize -DriveLetter C Resize-Partition -DriveLetter C -Size $size.SizeMax - ignore_errors: yes + register: resize_partition_result + failed_when: > + resize_partition_result.rc != 0 and + 'already the requested size' not in (resize_partition_result.stderr | default('')) + changed_when: resize_partition_result.rc == 0 - name: Set primary DC as DNS server ansible.windows.win_dns_client: @@ -35,15 +39,26 @@ - name: Reboot after promotion ansible.windows.win_reboot: msg: "Rebooting to apply Domain Controller promotion" - reboot_timeout: 1800 - post_reboot_delay: 60 + reboot_timeout: 3600 + connect_timeout: 30 + post_reboot_delay: 180 when: dc_promotion.reboot_required + - name: Wait for Active Directory Domain Services to be running + ansible.windows.win_service_info: + name: NTDS + register: ntds_service + retries: 20 + delay: 30 + until: + - ntds_service.exists + - ntds_service.services[0].state == "running" + - name: Force Active Directory replication ansible.windows.win_command: repadmin /syncall /A /e /d register: repadmin_result changed_when: false - ignore_errors: yes + failed_when: false - name: Show replication status ansible.builtin.debug: