--- - 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: policy_templates/PolicyDefinitions/ dest: "C:\\Windows\\PolicyDefinitions\\" force: true - name: Copy 'adml' group policy template files to DCs win_copy: src: policy_templates/en-US/ dest: "C:\\Windows\\PolicyDefinitions\\en-US\\" force: true - name: Group policy script tags: copy_script block: - name: Copy transfer scripts to fileserver win_copy: src: "OpenStackADBuildv5.ps1" dest: "C:\\eidf" force: true when: inventory_hostname in groups['meta-name_dc01'] - 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) vars: dc02_dns: "{{ os_project }}-{{ win_project }}-dc02" win_dns_client: adapter_names: "*" dns_servers: - "127.0.0.1" - "{{ hostvars[dc02_dns].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) vars: dc01_dns: "{{ os_project }}-{{ win_project }}-dc01" win_dns_client: adapter_names: "*" dns_servers: - "{{ hostvars[dc01_dns].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']