title: Ansible - check for task failure during looping task's execution
body: <p>I have a task that should run a list of SQL scripts. If there is an error during the execution of <strong>ANY</strong> of the scripts in the sequence, then the task should stop executing. </p>
  
  <p>Given the following task, is there a way that it can modified it to see the register's stdout for the current iteration of the loop to check if <code>'ERROR'</code> is in the stdout?</p>
  
  <pre><code>- name: Build and run SQLPlus commands
    shell: 'echo @{{ item }} | {{ sqlplus }} {{ db_user }}/{{ db_pass }}@{{ environment }}'
    register: sh1
    with_items:
      - ["a.sql", "b.sql"]
  #      failed_when: "'ERROR' in sh1.stdout_lines"
  </code></pre>
  
  <p>I was thinking something along the lines of the last commented line, but since <code>sh1</code> is a register variable from a looping task, the output from each SQL script resides within the <em>list</em> <code>results</code> of <code>sh1</code>; so I'm not sure how to access the specific stdout of the command that was just executed.</p>