...
|
...
|
@@ -8,24 +8,23 @@ DOCUMENTATION = """
|
8
|
8
|
lookup: dig
|
9
|
9
|
author: Jan-Piet Mens (@jpmens) <jpmens(at)gmail.com>
|
10
|
10
|
version_added: "1.9"
|
11
|
|
- short_description: use 'dig' to query DNS
|
|
11
|
+ short_description: query DNS using the dnspython library
|
12
|
12
|
requirements:
|
13
|
|
- - dig (CLI utility)
|
|
13
|
+ - dnspython (python library, http://www.dnspython.org/)
|
14
|
14
|
description: test
|
15
|
|
- lola:
|
16
|
|
-# - The dig lookup runs queries against DNS servers to retrieve DNS records for a specific name (FQDN - fully qualified domain name).
|
17
|
|
-# It is possible to lookup any DNS record in this manner.
|
18
|
|
-# - There is a couple of different syntaxes that can be used to specify what record should be retrieved, and for which name.
|
19
|
|
-# It is also possible to explicitly specify the DNS server(s) to use for lookups.
|
20
|
|
-# - In its simplest form, the dig lookup plugin can be used to retrieve an IPv4 address (DNS A record) associated with FQDN
|
21
|
|
-# - In addition to (default) A record, it is also possible to specify a different record type that should be queried.
|
22
|
|
-# This can be done by either passing-in additional parameter of format qtype=TYPE to the dig lookup, or by appending /TYPE to the FQDN being queried.
|
23
|
|
-# - If multiple values are associated with the requested record, the results will be returned as a comma-separated list.
|
24
|
|
-# In such cases you may want to pass option wantlist=True to the plugin, which will result in the record values being returned as a list
|
25
|
|
-# over which you can iterate later on.
|
26
|
|
-# - By default, the lookup will rely on system-wide configured DNS servers for performing the query.
|
27
|
|
-# It is also possible to explicitly specify DNS servers to query using the @DNS_SERVER_1,DNS_SERVER_2,...,DNS_SERVER_N notation.
|
28
|
|
-# This needs to be passed-in as an additional parameter to the lookup
|
|
15
|
+ - The dig lookup runs queries against DNS servers to retrieve DNS records for a specific name (FQDN - fully qualified domain name).
|
|
16
|
+ It is possible to lookup any DNS record in this manner.
|
|
17
|
+ - There is a couple of different syntaxes that can be used to specify what record should be retrieved, and for which name.
|
|
18
|
+ It is also possible to explicitly specify the DNS server(s) to use for lookups.
|
|
19
|
+ - In its simplest form, the dig lookup plugin can be used to retrieve an IPv4 address (DNS A record) associated with FQDN
|
|
20
|
+ - In addition to (default) A record, it is also possible to specify a different record type that should be queried.
|
|
21
|
+ This can be done by either passing-in additional parameter of format qtype=TYPE to the dig lookup, or by appending /TYPE to the FQDN being queried.
|
|
22
|
+ - If multiple values are associated with the requested record, the results will be returned as a comma-separated list.
|
|
23
|
+ In such cases you may want to pass option wantlist=True to the plugin, which will result in the record values being returned as a list
|
|
24
|
+ over which you can iterate later on.
|
|
25
|
+ - By default, the lookup will rely on system-wide configured DNS servers for performing the query.
|
|
26
|
+ It is also possible to explicitly specify DNS servers to query using the @DNS_SERVER_1,DNS_SERVER_2,...,DNS_SERVER_N notation.
|
|
27
|
+ This needs to be passed-in as an additional parameter to the lookup
|
29
|
28
|
options:
|
30
|
29
|
_terms:
|
31
|
30
|
description: domain(s) to query
|
...
|
...
|
@@ -200,7 +199,7 @@ class LookupModule(LookupBase):
|
200
|
200
|
'''
|
201
|
201
|
|
202
|
202
|
if HAVE_DNS is False:
|
203
|
|
- raise AnsibleError("Can't LOOKUP(dig): module dns.resolver is not installed")
|
|
203
|
+ raise AnsibleError("The dig lookup requires the python 'dnspython' library and it is not installed")
|
204
|
204
|
|
205
|
205
|
# Create Resolver object so that we can set NS if necessary
|
206
|
206
|
myres = dns.resolver.Resolver(configure=True)
|