title: Ansible condition when string not matching
body: <p>I am trying to write an Ansible playbook that only compiles Nginx if it's not already present and at the current version. However it compiles every time which is undesirable.</p>
  
  <p>This is what I have:  </p>
  
  <pre><code>- shell: /usr/local/nginx/sbin/nginx -v 2&gt;&amp;1
    register: nginxVersion
  - debug:
    var=nginxVersion
  
  - name: install nginx
    shell: /var/local/ansible/nginx/makenginx.sh
    when: "not nginxVersion == 'nginx version: nginx/1.8.0'"
    become: yes
  </code></pre>
  
  <p>The script all works apart from the fact that it runs the shell script every time to compile Nginx. The debug output for nginxVersion is:</p>
  
  <pre><code>ok: [server] =&gt; {
      "var": {
          "nginxVersion": {
              "changed": true,
              "cmd": "/usr/local/nginx/sbin/nginx -v 2&gt;&amp;1",
              "delta": "0:00:00.003752",
              "end": "2015-09-25 16:45:26.500409",
              "invocation": {
                  "module_args": "/usr/local/nginx/sbin/nginx -v 2&gt;&amp;1",
                  "module_name": "shell"
              },
              "rc": 0,
              "start": "2015-09-25 16:45:26.496657",
              "stderr": "",
              "stdout": "nginx version: nginx/1.8.0",
              "stdout_lines": [
                  "nginx version: nginx/1.8.0"
              ],
              "warnings": []
          }
      }
  }
  </code></pre>
  
  <p>According to the documentation I am on the right lines, what simple trick am I missing?</p>