2017-02-28 00:48:32 +01:00
|
|
|
#!/usr/bin/python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2018-02-25 03:09:54 +01:00
|
|
|
# Copyright: (c) 2017, Red Hat, Inc.
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
2017-02-28 00:48:32 +01:00
|
|
|
|
2017-08-16 05:16:38 +02:00
|
|
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
2017-03-14 17:07:22 +01:00
|
|
|
'status': ['preview'],
|
|
|
|
'supported_by': 'core'}
|
|
|
|
|
2017-02-28 00:48:32 +01:00
|
|
|
DOCUMENTATION = r'''
|
|
|
|
---
|
|
|
|
module: win_dns_client
|
|
|
|
version_added: "2.3"
|
|
|
|
short_description: Configures DNS lookup on Windows hosts
|
|
|
|
description:
|
|
|
|
- The C(win_dns_client) module configures the DNS client on Windows network adapters.
|
|
|
|
options:
|
|
|
|
adapter_names:
|
|
|
|
description:
|
|
|
|
- Adapter name or list of adapter names for which to manage DNS settings ('*' is supported as a wildcard value).
|
2019-11-17 22:30:06 +01:00
|
|
|
- The adapter name used is the connection caption in the Network Control Panel or the InterfaceAlias of C(Get-DnsClientServerAddress).
|
|
|
|
type: list
|
2018-02-25 03:09:54 +01:00
|
|
|
required: yes
|
2019-11-17 22:30:06 +01:00
|
|
|
dns_servers:
|
2017-02-28 00:48:32 +01:00
|
|
|
description:
|
2019-11-17 22:30:06 +01:00
|
|
|
- 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
|
2017-02-28 00:48:32 +01:00
|
|
|
DHCP-assigned values on connections where DHCP is enabled, or disable DNS lookup on statically-configured connections.
|
2019-11-17 22:30:06 +01:00
|
|
|
- IPv6 DNS servers can only be set on Windows Server 2012 or newer, older hosts can only set IPv4 addresses.
|
|
|
|
- Before 2.10 use ipv4_addresses instead.
|
|
|
|
type: list
|
2018-02-25 03:09:54 +01:00
|
|
|
required: yes
|
2019-11-17 22:30:06 +01:00
|
|
|
aliases: [ "ipv4_addresses", "ip_addresses", "addresses" ]
|
2017-02-28 00:48:32 +01:00
|
|
|
notes:
|
|
|
|
- When setting an empty list of DNS server addresses on an adapter with DHCP enabled, a change will always be registered, since it is not possible to
|
|
|
|
detect the difference between a DHCP-sourced server value and one that is statically set.
|
2018-02-25 03:09:54 +01:00
|
|
|
author:
|
|
|
|
- Matt Davis (@nitzmahone)
|
2017-02-28 00:48:32 +01:00
|
|
|
'''
|
|
|
|
|
2017-05-07 21:59:35 +02:00
|
|
|
EXAMPLES = r'''
|
2018-02-25 03:09:54 +01:00
|
|
|
- name: Set a single address on the adapter named Ethernet
|
|
|
|
win_dns_client:
|
|
|
|
adapter_names: Ethernet
|
2019-11-17 22:30:06 +01:00
|
|
|
dns_servers: 192.168.34.5
|
2018-02-25 03:09:54 +01:00
|
|
|
|
|
|
|
- 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: '*'
|
2019-11-17 22:30:06 +01:00
|
|
|
dns_servers:
|
2018-02-25 03:09:54 +01:00
|
|
|
- 192.168.34.5
|
|
|
|
- 192.168.34.6
|
|
|
|
log_path: C:\dns_log.txt
|
|
|
|
|
2019-11-17 22:30:06 +01:00
|
|
|
- name: Set IPv6 DNS servers on the adapter named Ethernet
|
|
|
|
win_dns_client:
|
|
|
|
adapter_names: Ethernet
|
|
|
|
dns_servers:
|
|
|
|
- '2001:db8::2'
|
|
|
|
- '2001:db8::3'
|
|
|
|
|
2018-02-25 03:09:54 +01:00
|
|
|
- name: Configure all adapters whose names begin with Ethernet to use DHCP-assigned DNS values
|
|
|
|
win_dns_client:
|
|
|
|
adapter_names: 'Ethernet*'
|
2019-11-17 22:30:06 +01:00
|
|
|
dns_servers: []
|
2017-02-28 00:48:32 +01:00
|
|
|
'''
|
|
|
|
|
2019-01-03 17:50:44 +01:00
|
|
|
RETURN = r'''
|
2017-02-28 00:48:32 +01:00
|
|
|
|
|
|
|
'''
|