Hii,
I'm using the 'until' loop to wait for a condition to be true:
---
- name: Do something until it doesn't fail
hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Wait for synced directory
community.docker.docker_container_exec:
container: ldap_consumer
command: install/check_sync_status.sh
register: status
until:
- status.failed != true
retries: 3600
delay: 6
- debug: var=status.stdout
This works:
dick.visser@GA0267 ~$ ansible-playbook work/tasks/until1.yml
PLAY [Do something until it doesn't fail]
**************************************************************
TASK [Wait for synced directory]
***********************************************************************
FAILED - RETRYING: [localhost]: Wait for synced directory (3600 retries left).
FAILED - RETRYING: [localhost]: Wait for synced directory (3599 retries left).
FAILED - RETRYING: [localhost]: Wait for synced directory (3598 retries left).
changed: [localhost]
TASK [debug]
*******************************************************************************************
ok: [localhost] =>
status.stdout: 'OK: Both local and remote have the same contextCSN:
20230707093240.412420Z#000000#000#000000'
PLAY RECAP
*********************************************************************************************
localhost : ok=2 changed=1 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
One problem is that the FAILED retry attempts are readable here in
plain text, but are otherwise pretty much invisible in my terminal.
This can be confusing when there have been so many attempts that the
terminal appears to be blank.
Another issue is that I can't seem to get a custom label on this loop.
The usual way:
loop_control:
label: status.stdout
extended: true
does not work...
Is there a way to do this?
thx!
Dick
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAF8BbLaBwtqMSn%2B7K%2BYFXSshunuWodOXFPW2JaecCrSaEzk2rw%40mail.gmail.com.