# unnecessary to use '{{' in conditionals...except when it isn't

**URL:** <https://forum.ansible.com/t/unnecessary-to-use-in-conditionals-except-when-it-isnt/18058>\
**Category:** Ansible Project\
**Created:** [April 22, 2015, 10:11pm UTC](https://forum.ansible.com/t/unnecessary-to-use-in-conditionals-except-when-it-isnt/18058 "2015-04-22T22:11:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shawn\_Ferry](https://avatars.discourse-cdn.com/v4/letter/s/f0a364/32.png) [@Shawn\_Ferry](https://forum.ansible.com/u/Shawn_Ferry)\
**Post date:** [April 22, 2015, 10:11pm UTC](https://forum.ansible.com/t/unnecessary-to-use-in-conditionals-except-when-it-isnt/18058/1 "2015-04-22T22:11:22Z")

</div>

[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

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [April 22, 2015, 10:30pm UTC](https://forum.ansible.com/t/unnecessary-to-use-in-conditionals-except-when-it-isnt/18058/2 "2015-04-22T22:30:22Z")

</div>

item.test is not a bare variable, in any case the warning has been  
removed in newer versions of ansible.

---

<div class="post-metadata">

**Author:** ![Tomasz\_Kontusz](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@Tomasz\_Kontusz](https://forum.ansible.com/u/Tomasz_Kontusz)\
**Post date:** [April 23, 2015, 6:47am UTC](https://forum.ansible.com/t/unnecessary-to-use-in-conditionals-except-when-it-isnt/18058/3 "2015-04-23T06:47:49Z")

</div>

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 [sferry@gmail.com](mailto:sferry@gmail.com) napisał:
