In this blog post, I will show you how to create an Active Directory Primary Zone with Ansible for windows.
The reason Active Directory zones are very good is that they are replicating with Active Directory. When we set up a new Domain Controller the AD DNS zones are automatically replicating which reduces the need to manage DNS as a separate system.
Before we get into the playbook, it is important to note that I am going to use a 2.10 Ansible module for Windows DNS. The module can work with Ansible 2.9, but you will need to run the following like to download the module first.
ansible-galaxy collection install community.windows
If you have Ansible 2.10 install, you don’t need to worry about the above line. To upgrade to Ansible 2.10, check this post.
The Playbook below will create a DNS zone and will apply to hosts in the DCs host group.
- name: "DNS Zone" hosts: DCs tasks: - name: "Create a DNS Zone" community.windows.win_dns_zone: name: svc.corporate.local replication: domain type: primary state: present
For more Ansible on Windows posts visit the following page.