Hi all,

I have tried to execute these tasks inside a bigger playbook:

    - name: Check if piwik folder already exists
      stat: path={{ item.documentroot }}/piwik/index.php
      with_items:
        apache_vhosts
      register: piwik_files
      tags: test

    - name: Download piwik
      get_url:
        url=http://builds.piwik.org/piwik.zip
        dest={{ item.documentroot }}
      with_items:
        apache_vhosts
      when: piwik_files.stat.exists == false
      tags: test

but I was always getting the error: "error while evaluating conditional:
piwik_files.stat.exists == false"

Using the ansible debug option to check the content of "piwik_files"
variable I found that I could workaround the error when I change my
conditional to this:

when: piwik_files.results[0].stat.exists == false

In other simpler playbooks I never found this problem with conditional and
I don't know why I am getting this issue in this one. Usually
variableName.stat.exists works without the need of doing
variableName.results[0].stat.exists

Any suggestion about why this could be happening or what am I doing wrong?
I am using ansible 1.7.2 in a centos7 machine with python2.7.5. I also
tried to use ansible 1.8.3 in a python virtualenv but I still get the same
error.

thanks in advance for your help
Pablo.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CANKY03WzLMgXZKBu5K64yT_8kxdHksHvLjS%3DymSDrN%3DBebRn8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to