title: Ansible error on shell command returning zero
body: <p>Ansible doesn't seem to be able to handle the result '0' for shell commands. This</p>
  
  <pre><code>- name: Check if swap exists
    shell: "swapon -s | grep -ci dev"
    register: swap_exists
  </code></pre>
  
  <p>Returns an error </p>
  
  <blockquote>
    <p>"msg": "non-zero return code"</p>
  </blockquote>
  
  <p>But when I replace "dev" with "type", which actually always occurs and gives a count of at least 1, then the command is successful and no error is thrown.</p>
  
  <p>I also tried with <code>command:</code> instead of <code>shell:</code> - it doesn't give an error, but then the command is also not executed.</p>