community.general.dnstxt (8.5.0) — lookup

query a domain(s)'s DNS txt fields

Authors: Jan-Piet Mens (@jpmens) <jpmens(at)gmail.com>

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Uses a python library to return the DNS TXT record for a domain.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: show txt entry
  ansible.builtin.debug:
    msg: "{{lookup('community.general.dnstxt', ['test.example.com'])}}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: iterate over txt entries
  ansible.builtin.debug:
    msg: "{{item}}"
  with_community.general.dnstxt:
    - 'test.example.com'
    - 'other.example.com'
    - 'last.example.com'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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(',')}}"

Inputs

    
_terms:
    description: domain or list of domains to query TXT records from
    elements: string
    required: true
    type: list

real_empty:
    default: false
    description:
    - Return empty result without empty strings, and return empty list instead of V(NXDOMAIN).
    - The default for this option will likely change to V(true) in the future.
    type: bool
    version_added: 6.0.0
    version_added_collection: community.general

Outputs

_list:
  description:
  - values returned by the DNS TXT record.
  type: list