title: Ansible: How to test that a registered variable is not empty?
body: <p>How can I test that stderr is non empty::</p>
  
  <pre><code>- name: Check script
    shell: . {{ venv_name }}/bin/activate &amp;&amp; myscritp.py
    args:
      chdir: "{{ home }}"
    sudo_user: "{{ user }}"
    register: test_myscript
  
  - debug: msg='myscritp is Ok'
    when: not test_myscript.stderr
  </code></pre>
  
  <p>So if there is no error I could read::</p>
  
  <pre><code>  TASK: [deploy | debug msg='critp is Ok] *******
    ok: [vagrant] =&gt; {
        "msg": "myscritp is Ok"
    }
  </code></pre>
  
  <p>In case the stderr is not empty a <code>FATAl</code> error occurs.</p>