On Sun, 17 May 2020 02:19:26 -0700 (PDT) Nikolay Dimov <[email protected]> wrote:
> I ended up using the following hack:
>
> - name: shell test
> shell: "{{ item }}"
> with_items:
> - /bin/true
> - /bin/false
> - /bin/true
> when: r_shell.rc|default(0)==0
> register: r_shell
>
> This exits on first failure.
No. It does not. This does not solve the problem that the loop "just keeps
running until it finishes the loop". The loop will run further after the
failure and the remaining items will be skipped because of the condition.
Then, because of the failure, the playbook will be terminated.
> To exit on success you can use:
>
> when: r_shell.rc|default(1)!=0
The result of this condition is completely different. The first successful
iteration makes all the rest to be skipped. But, because there was no
failure, the playbook will continue. Right?
HTH,
-vlado
--
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/20200518181624.47c8bfe5%40gmail.com.
pgpkliWuAk_ed.pgp
Description: OpenPGP digital signature
