title: Ansible - Skip task when at least one item fails in loop
body: <p>I am running few SQL scripts using sqlplus present. Before running I am getting all the list of sql files from that directory and storing it in <code>sql_out</code> as shown below.</p>
  
  <p>The problem is if one of the sql script fails the rest of the sql scripts still executes. I want to skip the task completely if any one of the script fails. Is there any way to skip. I reckon we can use <code>with_items</code> but not sure how to implement. Any help?</p>
  
  <pre><code>  - name: "Get sql files from directory"
      shell: ls {{ directory }}/{{ scripts_path }}/*.sql
      register: sql_out
      tags:
       - sql
  
    - name: "Execute each SQL Scripts"
      script: sqlplus.sh {{ db_username }} {{ db_password }} {{ 
      connection_string }} {{ schema }} {{ item }} 
      delegate_to: localhost
  
      with_items: sql_out.stdout_lines
      tags:
       - sql
  </code></pre>