win_dns_client – Configures DNS lookup on Windows hosts¶
- Before 2.10, when setting an empty list of DNS server addresses on an adapter with DHCP enabled, a change was always registered.
- In 2.10, DNS servers will always be reset if the format of nameservers in the registry is not comma delimited. See https://www.welivesecurity.com/2016/06/02/crouching-tiger-hidden-dns/
- name: Set a single address on the adapter named Ethernet win_dns_client: adapter_names: Ethernet dns_servers: 192.168.34.5 - name: Set multiple lookup addresses on all visible adapters (usually physical adapters that are in the Up state), with debug logging to a file win_dns_client: adapter_names: '*' dns_servers: - 192.168.34.5 - 192.168.34.6 log_path: C:\dns_log.txt - name: Set IPv6 DNS servers on the adapter named Ethernet win_dns_client: adapter_names: Ethernet dns_servers: - '2001:db8::2' - '2001:db8::3' - name: Configure all adapters whose names begin with Ethernet to use DHCP-assigned DNS values win_dns_client: adapter_names: 'Ethernet*' dns_servers: