community / community.general / 3.8.10 / lookup / dnstxt query a domain(s)'s DNS txt fields Authors: Jan-Piet Mens (@jpmens) <jpmens(at)gmail.com>community.general.dnstxt (3.8.10) — lookup
Install with ansible-galaxy collection install community.general:==3.8.10
collections: - name: community.general version: 3.8.10
Uses a python library to return the DNS TXT record for a domain.
- name: show txt entry ansible.builtin.debug: msg: "{{lookup('community.general.dnstxt', ['test.example.com'])}}"
- name: iterate over txt entries ansible.builtin.debug: msg: "{{item}}" with_community.general.dnstxt: - 'test.example.com' - 'other.example.com' - 'last.example.com'
- name: iterate of a comma delimited DNS TXT entry ansible.builtin.debug: msg: "{{item}}" with_community.general.dnstxt: "{{lookup('community.general.dnstxt', ['test.example.com']).split(',')}}"
_terms: description: domain or list of domains to query TXT records from elements: string required: true type: list
_list: description: - values returned by the DNS TXT record. type: list