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 184.108.40.206 DNS record which was not listed before the change
--- - name: "DNS" hosts: windows tasks: - name: "Set DNS Client" win_dns_client: adapter_names: Ethernet ipv4_addresses: - 192.168.0.10 - 220.127.116.11
For more great article about Ansible, visit the our Ansible category.