Create a DNS Record With Ansible for Windows

In this blog post I will show you how to create a DNS A record with Ansible on a Windows Server 2019 DNS Server.

This post follows the post I have shown you on how to create a DNS zone on a Windows Server DNS Server using Ansible.

Ansible 2.10

The playbook that you are about to see is using a new module for creating DNS records. This module is part of the Ansible 2.10 collections feature that uses Ansible-galaxy.

This module will work with Ansible 2.9 however you will need to run the following command first and install the collection that has the module.

ansible-galaxy collection install 


The playbook below will create a DNS record on my Domain Controller host. The A record name is testserver with an IP address of and the DNS zone name is svc.corporate.local

- name: "Create a DNS record"
  hosts: dc
    - name: "Crerate A record"
         name: "testserver"
         type: "A"
         value: ""
         zone: "svc.corporate.local"

All you need to do next is run the playbook and you re done. for more Ansible for Windows article visit our Ansible page.