title: Ansible: enforce pipefail
body: <p>Earlier today, we experienced a nasty issue that was caused by the following shell pipe:</p>
  
  <pre><code>- name: get remote branches
    shell: git ls-remote -h git@bitbucket.org:orga/repo.git | sed 's_.*refs/heads/__g'
    register: branches_remote
  </code></pre>
  
  <p>The <code>git</code> command fails, but the return code of the entire pipe is 0. <a href="https://stackoverflow.com/q/1550933/353337">This is default bash/sh behavior</a>.</p>
  
  <p>To fix this, in sh/bash, you can <code>set -o pipefail</code> or <code>set -e</code>. Is it possible to do that in ansible, preferably globally for all my <code>shell</code> commands?</p>