Skip to content

[Feature request] wait_for_txt - show failed lookups #72

@Kariton

Description

@Kariton
SUMMARY

This is a request for the module wait_for_txt.

  • Add the ability to define the "authoritative DNS server"
  • Show each try - even failed ones like an until loop does
ISSUE TYPE
  • Feature Idea
COMPONENT NAME

wait_for_txt

ADDITIONAL INFORMATION

I need to deal with split-DNS - and from my ansible host perspective the authoritative DNS server never knows the acme TXT record. Fast-forward: This is my problem with the awesome felixfontein.acme collection.

my solution for now:

- name: Wait for DNS entries to propagate
  ansible.builtin.command:
    argv:
      - dig
      - -t
      - TXT
      - +short
      - "@{{ acme_certificate_lookup_dns | d(ansible_facts['dns']['nameservers']) | list | random }}"
      - "{{ item.key }}"
  register: _acme_challenge_lookup
  until: _acme_challenge_lookup.stdout[1:-1] == item.value | first
  retries: 3
  delay: 300
  delegate_to: localhost
  run_once: true
  changed_when: false
  with_dict: "{{ acme_certificate_INTERNAL_challenge.challenge_data_dns }}"

BUT this just verify ONE random DNS server - not great, not terrible.
What I really like about this until is that it show me how often it fails while it is running. I really much appreciate this.

example for the fixed module:
var with real authoritative DNS server ;)

acme_certificate_lookup_dns: ['9.9.9.9', '1.1.1.1']
or
acme_certificate_lookup_dns: '9.9.9.9'

task

- name: Wait for DNS entries to propagate
  community.dns.wait_for_txt:
    dns_resolver: "{{ acme_certificate_lookup_dns | d(ansible_facts['dns']['nameservers']) | list }}"
    records: >-
      {{ acme_certificate_INTERNAL_challenge.challenge_data_dns | dict2items(key_name='name', value_name='values') | list }}
    timeout: 120
  delegate_to: localhost
  run_once: true

EDIT1:
There is now a better more complete workaround - which checks ALL defined (default) DNS server:
#72 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions