ansible.windows.win_dns_client – Configures DNS lookup on Windows hosts

Note

This plugin is part of the ansible.windows collection (version 1.3.0).

To install it use: ansible-galaxy collection install ansible.windows.

To use it in a playbook, specify: ansible.windows.win_dns_client.

Synopsis

Parameters

Parameter Choices/Defaults Comments
adapter_names
list / elements=string / required
Adapter name or list of adapter names for which to manage DNS settings ('*' is supported as a wildcard value).
The adapter name used is the connection caption in the Network Control Panel or the InterfaceAlias of Get-DnsClientServerAddress.
dns_servers
list / elements=string / required
Single or ordered list of DNS servers (IPv4 and IPv6 addresses) to configure for lookup.
An empty list will configure the adapter to use the DHCP-assigned values on connections where DHCP is enabled, or disable DNS lookup on statically-configured connections.
IPv6 DNS servers can only be set on Windows Server 2012 or newer, older hosts can only set IPv4 addresses.

aliases: ipv4_addresses, ip_addresses, addresses

Examples

- name: Set a single address on the adapter named Ethernet
  ansible.windows.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
  ansible.windows.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
  ansible.windows.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
  ansible.windows.win_dns_client:
    adapter_names: 'Ethernet*'
    dns_servers: []

Authors

  • Matt Davis (@nitzmahone)
  • Brian Scholer (@briantist)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/ansible/windows/win_dns_client_module.html