mirror of
https://git.ecdf.ed.ac.uk/win_automation/windows-ansible.git
synced 2026-10-26 12:37:21 +00:00
73 lines
2.3 KiB
YAML
73 lines
2.3 KiB
YAML
---
|
|
- 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)
|
|
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']
|
|
|