How do I exit Ansible play without error on a condition
<p>I want to exit without an error (I know about <a href="http://docs.ansible.com/ansible/assert_module.html" rel="noreferrer">assert</a> and <a href="http://docs.ansible.com/ansible/fail_module.html" rel="noreferrer">fail</a> modules) when I meet a certain condition. The following code exits but with a failure:</p>

<pre><code>  tasks:

    - name: Check if there is something to upgrade
      shell: if apt-get --dry-run upgrade | grep -q "0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded"; then echo "no"; else echo "yes"; fi
      register: upgrading

    - name: Exit if nothing to upgrade
      fail: msg="Nothing to upgrade"
      when: upgrading.stdout == "no"
</code></pre>