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. To exit on success you can use: when: r_shell.rc|default(1)!=0 This is obviously a hack, and it is strange that register looks different in the task and after the task ends, but it does the job. It would have been great if the register had the final form and the item results were appended as tasks were executed so we can check the results there with filters. -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1314a3ed-bf48-4a4d-b3e9-ee18daf29ae4%40googlegroups.com.