Awesome, I got it to work with my nios task as well, just had to change rc 
to failed since I had no rc in my output.

I'm not totally sure I follow why it skips after the first success though.  
Can you explain what's happening in this statement:  condition: "{{ 
(result|default({'rc': 1})).rc == 0 }}"



On Thursday, June 25, 2020 at 5:13:16 PM UTC-4, Vladimir Botka wrote:
>
> On Thu, 25 Jun 2020 13:05:23 -0400 
> Brian Coca <[email protected] <javascript:>> wrote: 
>
> > something like (might need to tweak syntax to get right): 
> > when: not select(result[|deault({'results': []}, 'success' )|list 
> > will skip the rest of the iterations once one succeeds 
>
> Thank you very much! I got it. For example 
>
>     - command: '[ "{{ item }}" -gt "3" ]' 
>       loop: "{{ range(1, 5 + 1)|list }}" 
>       register: result 
>       ignore_errors: true 
>       when: not condition 
>       vars: 
>         condition: "{{ (result|default({'rc': 1})).rc == 0 }}" 
>
> gives 
>
>     changed: [localhost] => (item=4) 
>     skipping: [localhost] => (item=5) 
>     ...ignoring 
>
>
> -- 
> Vladimir Botka 
>

-- 
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/a5641bbb-5e7e-46e2-bb59-d78448cbdb63o%40googlegroups.com.

Reply via email to