ansible.builtin.dnstxt (v2.9.27) — lookup

query a domain(s)'s DNS txt fields

| "added in version" 0.9 of ansible.builtin"

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

Install Ansible via pip

Install with pip install ansible==2.9.27

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
  debug: msg="{{lookup('dnstxt', ['test.example.com'])}}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: iterate over txt entries
  debug: msg="{{item}}"
  with_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
  debug: msg="{{item}}"
  with_dnstxt: "{{lookup('dnstxt', ['test.example.com']).split(',')}}"

Inputs

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

Outputs

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