You don't use Jinja2 inside when statements. Further, not all python functions, including the OS module, are exposed, and what you are saying would be an implicit local operation anyway.
You would need to run the stat module, register the result, and use that - stat: path=/path/to/file register: foo - deubg: var=foo # see what's available in foo, just as an FYI - shell: example when: foo.stat.isdir On Fri, Jul 18, 2014 at 12:31 PM, 'Diogene Laerce' via Ansible Project < [email protected]> wrote: > Hi, > > I would like to evaluate the following condition : > > ############################################# > > - name: Make Debian package > shell: command=make deb chdir=/home/{{ user_installer }}/src/Python.3.4.1 > when: "os.path.isdir('/home/{{ user_installer }}/src/Python-3.4.1') == > True" > > ############################################# > > But I get this error message : > > "error when evaluating conditional" > > The condition should return True. Do I do something syntactically wrong ? > I saw this syntax on Google but with previous versions of Ansible, does > it still > support this ? > > Thanks, > > -- > “One original thought is worth a thousand mindless quotings.” > “Le vrai n'est pas plus sûr que le probable.” > > Diogene Laerce > > > > -- 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/CA%2BnsWgyhaASa9cuccDpTnVpMWc1_653pgojeg%3Dhajf_AMxNNyQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
