Update Windows DNS Settings With Ansible

Today we will learn how to update multiple Windows managed hosted DNS client address with Ansible.

The use case for this operation could be the need to change an existing DNS server IP address on multiple hosts. Using Ansible for something like this on multiple machine can save huge amount of time.

I remember a few times I had to update 20 servers with a new DNS server IP address which can take hours sometimes. With Ansible, this task takes minutes.


Below is the playbook that I am going to use with the win_dns_client command which handles all the DNS settings on managed Windows machines. In my case, I am adding the DNS record which was not listed before the change

- name: "DNS"
  hosts: windows
    - name: "Set DNS Client"
          adapter_names: Ethernet

For more great article about Ansible, visit the our Ansible category.

Success! You're on the list.