# when\_string and when and errors going from ansible 1.1 to 1.2

**URL:** <https://forum.ansible.com/t/when-string-and-when-and-errors-going-from-ansible-1-1-to-1-2/12945>\
**Category:** Ansible Project\
**Created:** [June 11, 2013, 6:16pm UTC](https://forum.ansible.com/t/when-string-and-when-and-errors-going-from-ansible-1-1-to-1-2/12945 "2013-06-11T18:16:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Seth\_Vidal](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@Seth\_Vidal](https://forum.ansible.com/u/Seth_Vidal)\
**Post date:** [June 11, 2013, 6:16pm UTC](https://forum.ansible.com/t/when-string-and-when-and-errors-going-from-ansible-1-1-to-1-2/12945/1 "2013-06-11T18:16:21Z")

</div>

Hi,  
I had some conditional tasks like this:

when\_string: ${inventory\_hostname} not in ${result.list\_vms}

They worked in 1.1  
In 1.2 they aborted with:

fatal: [127.0.0.1] =\> Conditional expression must evaluate to True or  
False: ... "

After some noodling around I figure out that I needed to change it to:

when: inventory\_hostname not in result.list\_vms

and it worked.

So my questions:  
1. is this expected?  
2. is when\_string completely deprecated?  
3. if so then maybe a nicer error is in order?  
4. if not then what is wrong in the first example?

Thanks,  
-sv
