promote DC01 and DC02

This commit is contained in:
abrown38 committed 2024-04-09 10:03:13 +00:00
1 parent 9b40efacba
commit 8122c3b332
1 file changed
+70
@@ -0,0 +1,70 @@
---
- name: Copy Templates
tags: copy_templates
block:
- name: Remove existing Group Policy Templates
win_file:
path: "C:\\Windows\\PolicyDefinitions\\"
state: absent
- name: Copy 'admx' group policy template files to DCs
win_copy:
src: /deployments/{{ os_project }}-{{ win_project }}/policy_templates/PolicyDefinitions/
dest: "C:\\Windows\\PolicyDefinitions\\"
force: true
- name: Copy 'adml' group policy template files to DCs
win_copy:
src: /deployments/{{ os_project }}-{{ win_project }}/policy_templates/en-US/
dest: "C:\\Windows\\PolicyDefinitions\\en-US\\"
force: true
- name: Promote DC01
tags: promote_dc01
block:
- name: Promote DC01 to domain controller
win_domain:
dns_domain_name: "{{ win_project }}.loc"
safe_mode_password: "{{ safemode_password }}"
domain_netbios_name: "{{ win_project|upper }}"
register: dc01_promotion
- name: Setting DNS Servers (Primary DC)
win_dns_client:
adapter_names: "*"
ipv4_addresses:
- "127.0.0.1"
- "{{ hostvars['eidf075-dev-dc02'].ansible_host }}"
- name: Rebooting DC01 post promotion to domain controller
win_reboot:
reboot_timeout_sec: 1200
when: dc01_promotion.reboot_required | default(false) == true
when: inventory_hostname in groups['meta-name_dc01']
- name: Promote DC02
tags: promote_dc02
block:
- name: Setting DNS Servers (Secondary DC)
tags: promote_dc01
win_dns_client:
adapter_names: "*"
ipv4_addresses:
- "{{ hostvars['eidf075-dev-dc01'].ansible_host }}"
- "127.0.0.1"
- name: Promote DC02 to domain controller
win_domain_controller:
dns_domain_name: "{{ win_project }}.loc"
domain_admin_user: "Administrator@{{ win_project }}.loc"
domain_admin_password: "{{ ansible_password }}"
safe_mode_password: "{{ safemode_password }}"
state: domain_controller
register: dc02_promotion
- name: Rebooting DC02 post promotion to domain controller
win_reboot:
reboot_timeout_sec: 1200
when: dc02_promotion.reboot_required | default(false) == true
when: inventory_hostname in groups['meta-name_dc02']