community.dns.nameserver_info module – Look up 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_info
.
New in community.dns 2.6.0
Synopsis
Retrieve all nameservers that are responsible for a DNS name.
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: |
|
Whether to resolve the nameserver names to IP addresses. Choices:
|
|
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: |
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 |
Examples
- name: Retrieve name servers of two DNS names
community.dns.nameserver_info:
name:
- www.example.com
- example.org
register: result
- name: Show nameservers for www.example.com
ansible.builtin.debug:
msg: '{{ result.results[0].nameserver }}'
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Information on the nameservers for every DNS name provided in Returned: always Sample: |
|
The DNS name this entry is for. Returned: always Sample: |
|
A list of nameservers for this DNS name. Returned: success Sample: |