-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature request] wait_for_txt - show failed lookups #72
Comments
Makes sense to have such an option! I'll work on this later this week / next week (I'm pretty packed with other stuff right now). About the number of failed tries: the result of the module already contains {
"check_count": 1,
"done": true,
"name": "github.io",
"values": {
"dns1.p05.nsone.net.": [
"v=spf1 a -all"
],
"dns2.p05.nsone.net.": [
"v=spf1 a -all"
],
"dns3.p05.nsone.net.": [
"v=spf1 a -all"
],
"dns4.p05.nsone.net.": [
"v=spf1 a -all"
],
"ns-1339.awsdns-39.org.": [
"v=spf1 a -all"
],
"ns-1622.awsdns-10.co.uk.": [
"v=spf1 a -all"
],
"ns-393.awsdns-49.com.": [
"v=spf1 a -all"
],
"ns-692.awsdns-22.net.": [
"v=spf1 a -all"
]
}
} (In this case |
What you describe is just the fact that the module itself includes the Like this:
|
Just for anyone looking for this, This includes the DNS check as an own file and a variable to define alternative DNS server. My assumption is that you use the
acme_certificate_lookup_dns:
- '9.9.9.9'
- '149.112.112.112'
---
- name: "Wait for DNS entries to propagate to {{ dns_resolver }}"
ansible.builtin.command:
argv:
- dig
- -t
- TXT
- +short
- "@{{ dns_resolver }}"
- "{{ item.0.key }}"
register: _acme_challenge_lookup
until: item.1 in _acme_challenge_lookup.stdout
retries: 3
delay: 120
delegate_to: localhost
run_once: true
changed_when: false
loop: "{{ acme_certificate_INTERNAL_challenge.challenge_data_dns | dict2items | subelements('value') }}" And now loop that file for each DNS server:
- name: check DNS propagation
ansible.builtin.include: dns-check.yml
vars:
dns_resolver: "{{ _acme_certificate_lookup_dns }}"
loop_control:
loop_var: _acme_certificate_lookup_dns
loop: "{{ acme_certificate_lookup_dns | d(ansible_facts['dns']['nameservers']) }}" result: TASK [acme_certificate : check DNS propagation] *******************************************************************************
included: tasks/dns-check.yml for foo.example.com => (item=9.9.9.9)
included: tasks/dns-check.yml for foo.example.com => (item=149.112.112.112)
TASK [acme_certificate : Wait for DNS entries to propagate to 9.9.9.9] *******************************************************************************
FAILED - RETRYING: Wait for DNS entries to propagate to 9.9.9.9 (3 retries left).
ok: [foo.example.com -> localhost] => (item=[{'key': '_acme-challenge.foo.example.com', 'value': ['XXX', 'YYY']}, 'XXX'])
ok: [foo.example.com -> localhost] => (item=[{'key': '_acme-challenge.foo.example.com', 'value': ['XXX', 'YYY']}, 'YYY'])
TASK [acme_certificate : Wait for DNS entries to propagate to 149.112.112.112] *******************************************************************************
ok: [foo.example.com -> localhost] => (item=[{'key': '_acme-challenge.foo.example.com', 'value': ['XXX', 'YYY']}, 'XXX'])
ok: [foo.example.com -> localhost] => (item=[{'key': '_acme-challenge.foo.example.com', 'value': ['XXX', 'YYY']}, 'YYY']) @felixfontein |
That's probably not possible if I understand you correctly. A module can only output a result when it's done (resp. it can only pass something to the controller, and the callback plugin the user installed can decide whether to output it or not) and not yield any intermediate result. So you either see that output when the module is done (which depending on the propagation times can be a long time), or you don't see anything at all (because the callback decides not to output anything, for example the default callback with the default verbosity level). |
There is a proposal for adding support for something like this to ansible-core (ansible/proposals#92). I haven't given up hope that we will eventually get that, but I don't expect it to happen anytime soon... |
Thank you for that detailed answer. |
I adjusted the title since providing a list of servers is already possible ( |
SUMMARY
This is a request for the module
wait_for_txt
.until
loop doesISSUE TYPE
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:
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 ;)task
EDIT1:
There is now a better more complete workaround - which checks ALL defined (default) DNS server:
#72 (comment)
The text was updated successfully, but these errors were encountered: