community.dns.nameserver_record_info module – Look up all records of a type from all nameservers for a DNS name
Note
This module is part of the community.dns collection (version 2.9.7).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.dns
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.dns.nameserver_record_info
.
New in community.dns 2.6.0
Synopsis
Given a DNS name and a record type, will retrieve all nameservers that are responsible for this DNS name, and from them all records for this name of the given type.
Requirements
The below requirements are needed on the host that executes this module.
dnspython >= 1.15.0 (maybe older versions also work)
Parameters
Parameter |
Comments |
---|---|
When set to When set to Choices:
|
|
A list of DNS names whose nameservers to retrieve. |
|
Number of retries for DNS query timeouts. Default: |
|
Timeout per DNS query in seconds. Default: |
|
The DNS server(s) to use to look up the result. Must be a list of one or more IP addresses. By default, the system’s standard resolver is used. |
|
How often to retry on SERVFAIL errors. Default: |
|
The record type to retrieve. Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full This action does not modify state. |
Can run in |
|
Support: N/A This action does not modify state. |
Will return details on what has changed (or possibly needs changing in |
Notes
Note
dnspython before 2.0.0 does not correctly support (un-)escaping UTF-8 in TXT-like records. This can result in wrongly decoded TXT records. Please use dnspython 2.0.0 or later to fix this issue; see also https://github.com/rthalley/dnspython/issues/321. Unfortunately dnspython 2.0.0 requires Python 3.6 or newer.
Examples
- name: Retrieve TXT values from all nameservers for two DNS names
community.dns.nameserver_record_info:
name:
- www.example.com
- example.org
type: TXT
register: result
- name: Show TXT values for www.example.com for all nameservers
ansible.builtin.debug:
msg: '{{ result.results[0].result }}'
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Information on the records for every DNS name provided in Returned: always Sample: |
|
The DNS name this entry is for. Returned: always Sample: |
|
A list of values per nameserver. Returned: success Sample: |
|
The nameserver. Returned: success Sample: |
|
The records of type Depending on For Returned: success Sample: |
|
The algorithm ID. Returned: if |
|
The altitude. Returned: if |
|
The certificate. Returned: if |
|
The CPU. Returned: if |
|
The digest. Returned: if |
|
The digest’s type. Returned: if |
|
The exchange server. Returned: if |
|
The expiration Unix timestamp. Returned: if |
|
Number of seconds after which secondary name servers should stop answering request for this zone if the main name server does not respond. Returned: if |
|
The fingerprint. Returned: if |
|
Flags. This is actually of type Returned: if |
|
The fingerprint’s type. Returned: if |
|
The horizontal precision of the location. Returned: if |
|
The inception Unix timestamp. Returned: if |
|
The number of iterations. Returned: if |
|
The key. Returned: if |
|
The key’s tag. Returned: if |
|
The labels. Returned: if |
|
The location’s latitude. Returned: if |
|
The location’s longitude. Returned: if |
|
The mbox. Returned: if |
|
Used to calculate the TTL for purposes of negative caching. Returned: if |
|
Primary main name server for this zone. Returned: if |
|
The mtype. Returned: if |
|
The next value. Returned: if |
|
The order value. Returned: if |
|
The original TTL. Returned: if |
|
The operating system. Returned: if |
|
The port. Returned: if |
|
The preference value for this record. Returned: if |
|
The priority value for this record. Returned: if |
|
The protocol. Returned: if |
|
Number of seconds after which secondary name servers should query the main name server for the SOA record to detect zone changes. Returned: if |
|
A regular expression. Returned: if |
|
The replacement. Returned: if |
|
Number of seconds after which secondary name servers should retry to request the serial number from the main name server if the main name server does not respond. Returned: if |
|
E-mail address of the administrator responsible for this zone. Returned: if |
|
The salt. Returned: if |
|
The selector. Returned: if |
|
Serial number for this zone. Returned: if |
|
The service. Returned: if |
|
The signature. Returned: if |
|
The signer. Returned: if |
|
The size of the location. Returned: if |
|
List of strings for this record. See |
|
The tag. Returned: if |
|
The target. Returned: if |
|
The TXT value. Returned: if |
|
The type covered. Returned: if |
|
The usage flag. Returned: if |
|
The vertical precision of the location. Returned: if |
|
The service’s weight. Returned: if |
|
The windows. Returned: if |