ansible.builtin.win_dns_client (v2.9.27) — module

Configures DNS lookup on Windows hosts

| "added in version" 2.3 of ansible.builtin"

Authors: Matt Davis (@nitzmahone)

preview | supported by core

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

The C(win_dns_client) module configures the DNS client on Windows network adapters.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Set a single address on the adapter named Ethernet
  win_dns_client:
    adapter_names: Ethernet
    ipv4_addresses: 192.168.34.5
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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: '*'
    ipv4_addresses:
    - 192.168.34.5
    - 192.168.34.6
    log_path: C:\dns_log.txt
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure all adapters whose names begin with Ethernet to use DHCP-assigned DNS values
  win_dns_client:
    adapter_names: 'Ethernet*'
    ipv4_addresses: []

Inputs

    
adapter_names:
    description:
    - 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
      via C(Get-NetAdapter), eg C(Local Area Connection).
    required: true
    type: str

ipv4_addresses:
    description:
    - Single or ordered list of DNS server IPv4 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.
    required: true
    type: str