The brackets are, in fact, necessary. The effect your see is a known problem 
with a feature called "bare variable detection" - it never worked well, and 
probably never will (it's a problem since at least 1.6).

Shawn Ferry <[email protected]> napisał:
>[WARNING]: It is unnecessary to use '{{' in conditionals, leave
>variables 
>in loop expressions bare.
>
>I'm using with_items for conditions in the fail module and it seems
>that I 
>can't use bare expressions.  I have a playbook that with actions that
>can 
>only run if a number of pre-conditions have been met. Instead of
>defining N 
>tasks to grep in a file I'm stashing the contents of the file and using
>
>multiple search conditions. 
>
>Is there a different/better way to do this type of testing? 
>Is there some way to do this without dereferenceing
>
>---
>- hosts: 127.0.0.1
>  vars:
>    truthy_string: This message contains the truth
>  connection: local
>  tasks:
>    - name: test
>      fail:
>        msg: "{{ item.msg }}"
>      with_items: 
>        - { test: True != True, msg: The truth is still truthy }
>        - { test: True != False, msg: The truth is out there }
>        # Indicative of the actual statements I'm using
>    - { test: truthy_string | search('the truth') == False, msg: It is 
>true}
>      # Dereferenced variables work but present a warning
>      when: "{{ item.test }}"
>      # Bare variables fail every time
>      #when: item.test
>
>
>--
>Shawn
>
>-- 
>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/fc050057-69ff-40bf-891b-ca4cb0a9c195%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
Wysłane za pomocą K-9 Mail.

-- 
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/c18459d9-76e8-4739-98e4-018294717bc0%40email.android.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to