Files
windows-ansible/ansible/roles/win_domain_membership/tasks/join.yml
T
2024-08-21 20:47:57 +01:00

44 lines
1.5 KiB
YAML

---
- name: Join Domain
tags: join_domain
block:
- name: Set DC01 and DC02 as DNS servers
tags: set_dns
vars:
dc01_dns: "{{ os_project }}-{{ win_project }}-dc01"
dc02_dns: "{{ os_project }}-{{ win_project }}-dc02"
win_dns_client:
adapter_names: "*"
ipv4_addresses:
- "{{ hostvars[dc01_dns].ansible_host }}"
- "{{ hostvars[dc02_dns].ansible_host }}"
- name: disable firewall
tags: disable_firewall
community.windows.win_firewall:
state: disabled
profiles:
- Domain
- name: membership | Joining Fileserver, Choco and WSUS machines to domain
tags: join_servers
microsoft.ad.membership:
dns_domain_name: "{{ win_project }}.loc"
domain_admin_user: "Administrator@{{ win_project }}.loc"
domain_admin_password: "{{ ansible_password }}"
state: "domain"
domain_ou_path: ou=Management Computers,dc={{ win_project }},dc=loc
reboot: true
when: inventory_hostname in groups['meta-type_server']
- name: Joining Client machines to domain
tags: join_clients
microsoft.ad.membership:
dns_domain_name: "{{ win_project }}.loc"
domain_admin_user: "Administrator@{{ win_project }}.loc"
domain_admin_password: "{{ ansible_password }}"
state: "domain"
domain_ou_path: ou=Workbench,dc={{ win_project }},dc=loc
reboot: true
when: "inventory_hostname in groups['meta-type_client']"