четверг, 18 октября 2018 г., 11:34:25 UTC+3 пользователь Karl Auer написал:
>
> Try this:
>
> # Test random filter
> - hosts: localhost
>
> tasks:
> - name: Test random
> set_fact:
> rand_result: "{{ 5 |random }}"
> with_sequence: count=10
>
> Basically the change of item forces a re-evaluation, even though nothing
> is changing inside the loop.
>
I tried to use this:
- name: Wait DNS A record host.example.com registered
set_fact:
lookup_result: "{{ lookup('dig', 'host.example.com.') }}"
until: lookup_result != 'NXDOMAIN'
retries: 1
delay: 3
with_sequence: count=20
But the overall result of the task is a failure (I think this is because
there is fail iterations at start).
Another flaw of this workaround is that task runs all 20 iterations even if
there is DNS record, say, on 7 iteration (no 'break loop' logic).
I replace my task with this workaround:
- name: Wait DNS A record host.example.com registered
command: "dig host.example.com +short"
register: dig_result
until: dig_result.stdout != ''
retries: 20
delay: 3
JFYI there is related issue on
Github: https://github.com/ansible/ansible/issues/44128
>
> However: You may still have a problem with DNS. A failed lookup (NXDOMAIN)
> will set a negative cache time on the result; no nameserver will issue a
> new query until the negative cache time has expired. The negative cache
> time is commonly set to values between five minutes and a few hours; very
> stable zones may set higher values. If the zone is under your control -
> which it looks like it is - set the negative cache time low when you are
> working on the zone. It's the last field in the SOA.
>
>
Yes, this is private zone under my control and negative cache already set
to 60 seconds which is fine for me.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/d09a4fe9-7e14-4cfe-ac9e-5789399ebd71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.