New in version 1.9.
The below requirements are needed on the local master node that executes this lookup.
Parameter |
Choices/Defaults |
Configuration |
Comments |
---|---|---|---|
_terms
|
|
|
domain(s) to query
|
flat
|
Default:
yes
|
|
If 0 each record is returned as a dictionary, otherwise a string
|
qtype
|
|
|
record type to query
|
Note
- name: Simple A record (IPV4 address) lookup for example.com
debug: msg="{{ lookup('dig', 'example.com.')}}"
- name: "The TXT record for example.org."
debug: msg="{{ lookup('dig', 'example.org.', 'qtype=TXT') }}"
- name: "The TXT record for example.org, alternative syntax."
debug: msg="{{ lookup('dig', 'example.org./TXT') }}"
- name: use in a loop
debug: msg="MX record for gmail.com {{ item }}"
with_items: "{{ lookup('dig', 'gmail.com./MX', wantlist=True) }}"
- debug: msg="Reverse DNS for 192.0.2.5 is {{ lookup('dig', '192.0.2.5/PTR') }}"
- debug: msg="Reverse DNS for 192.0.2.5 is {{ lookup('dig', '5.2.0.192.in-addr.arpa./PTR') }}"
- debug: msg="Reverse DNS for 192.0.2.5 is {{ lookup('dig', '5.2.0.192.in-addr.arpa.', 'qtype=PTR') }}"
- debug: msg="Querying 198.51.100.23 for IPv4 address for example.com. produces {{ lookup('dig', 'example.com', '@198.51.100.23') }}"
- debug: msg="XMPP service for gmail.com. is available at {{ item.target }} on port {{ item.port }}"
with_items: "{{ lookup('dig', '_xmpp-server._tcp.gmail.com./SRV', 'flat=0', wantlist=True) }}"
Common return values are documented here, the following are the fields unique to this lookup:
Key |
Returned |
Description |
---|---|---|
_list
|
list of composed strings or dictonaries with key and value If a dictionary, fields shows the keys returned depending on query type
|
Hint
If you notice any issues in this documentation you can edit this document to improve it.