community.dns.wait_for_txt (1.2.3) — module

Wait for TXT entries to be available on all authoritative nameservers

| "added in version" 0.1.0 of community.dns"

Authors: Felix Fontein (@felixfontein)

Install collection

Install with ansible-galaxy collection install community.dns:==1.2.3


Add to requirements.yml

  collections:
    - name: community.dns
      version: 1.2.3

Description

Wait for TXT entries with specific values to show up on B(all) authoritative nameservers for the DNS name.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Wait for a TXT entry to appear
  community.dns.wait_for_txt:
    records:
      # We want that www.example.com has a single TXT record with value 'Hello world!'.
      # There should not be any other TXT record for www.example.com.
      - name: www.example.com
        values: "Hello world!"
        mode: equals
      # We want that example.com has a specific SPF record set.
      # We do not care about other TXT records.
      - name: www.example.com
        values: "v=spf1 a mx -all"
        mode: subset

Inputs

    
records:
    description:
    - A list of DNS names with TXT entries to look out for.
    elements: dict
    required: true
    suboptions:
      mode:
        choices:
        - subset
        - superset
        - superset_not_empty
        - equals
        - equals_ordered
        default: subset
        description:
        - Comparison modes for the values in I(values).
        - If C(subset), I(values) should be a (not necessarily proper) subset of the TXT
          values set for the DNS name.
        - If C(superset), I(values) should be a (not necessarily proper) superset of the
          TXT values set for the DNS name. This includes the case that no TXT entries
          are set.
        - If C(superset_not_empty), I(values) should be a (not necessarily proper) superset
          of the TXT values set for the DNS name, assuming at least one TXT record is
          present.
        - If C(equals), I(values) should be the same set of strings as the TXT values
          for the DNS name (up to order).
        - If C(equals_ordered), I(values) should be the same ordered list of strings as
          the TXT values for the DNS name.
        type: str
      name:
        description:
        - A DNS name, like C(www.example.com).
        required: true
        type: str
      values:
        description:
        - The TXT values to look for.
        elements: str
        required: true
        type: list
    type: list

timeout:
    description:
    - Global timeout for waiting for all records in seconds.
    - If not set, will wait indefinitely.
    type: float

max_sleep:
    default: 10
    description:
    - Maximal amount of seconds to sleep between two rounds of probing the TXT records.
    type: float

query_retry:
    default: 3
    description:
    - Number of retries for DNS query timeouts.
    type: int

query_timeout:
    default: 10
    description:
    - Timeout per DNS query in seconds.
    type: float

always_ask_default_resolver:
    default: true
    description:
    - When set to C(true) (default), will use the default resolver to find the authoritative
      nameservers of a subzone.
    - When set to C(false), will use the authoritative nameservers of the parent zone
      to find the authoritative nameservers of a subzone. This only makes sense when the
      nameservers were recently changed and haven't propagated.
    type: bool

Outputs

completed:
  description:
  - How many of the checks were completed.
  returned: always
  sample: 3
  type: int
records:
  contains:
    check_count:
      description:
      - How often the TXT records for this DNS name were checked.
      returned: always
      sample: 3
      type: int
    done:
      description:
      - Whether the check completed.
      returned: always
      sample: false
      type: bool
    name:
      description:
      - The DNS name this check is for.
      returned: always
      sample: example.com
      type: str
    values:
      description:
      - For every authoritative nameserver for the DNS name, lists the TXT records
        retrieved during the last lookup made.
      - Once the check completed for all TXT records retrieved, the TXT records for
        this DNS name are no longer checked.
      - If these are multiple TXT entries for a nameserver, the order is as it was
        received from that nameserver. This might not be the same order provided in
        the check.
      elements: list
      returned: lookup was done at least once
      sample:
        ns1.example.com:
        - TXT value 1
        - TXT value 2
        ns2.example.com:
        - TXT value 2
      type: dict
  description:
  - Results on the TXT records queried.
  - The entries are in a 1:1 correspondence to the entries of the I(records) parameter,
    in exactly the same order.
  elements: dict
  returned: always
  sample:
  - check_count: 1
    done: true
    name: example.com
    values:
    - a
    - b
    - c
  - check_count: 0
    done: false
    name: foo.example.org
  type: list