# Problem with negation of "False"-evaluated vars

**URL:** <https://forum.ansible.com/t/problem-with-negation-of-false-evaluated-vars/14383>\
**Category:** Ansible Project\
**Created:** [January 20, 2014, 11:09am UTC](https://forum.ansible.com/t/problem-with-negation-of-false-evaluated-vars/14383 "2014-01-20T11:09:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dmitry\_Horbach](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@Dmitry\_Horbach](https://forum.ansible.com/u/Dmitry_Horbach)\
**Post date:** [January 20, 2014, 11:09am UTC](https://forum.ansible.com/t/problem-with-negation-of-false-evaluated-vars/14383/1 "2014-01-20T11:09:37Z")

</div>

Hi All,

Found something strange (possible bug?) in evaluating True/False inside vars.  
Only in one particular case - if variable is evaluated as “False” - its not converted to “True” with “not”

In my example false\_eval is evaluated to “False” inside debug module but “not false\_eval” is still “False”. Any reason for that?

**- debug: var=false\_eval**

TASK: [debug var=false\_eval] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost] =\> {  
“false\_eval”: “False”  
}  
**- debug: var={{not false\_eval}}**

TASK: [debug var=False] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost] =\> {  
“False”: “False”  
}

playbook.yml

- hosts: localhost  
gather\_facts: no

vars:  
foo: bar  
true\_eval: ‘{{ foo == “bar” }}’  
false\_eval: ‘{{ foo != “bar” }}’

tasks:

- debug: var=true\_eval
- debug: var={{ not true\_eval }}
- debug: var=false\_eval
- debug: var={{not false\_eval}}

Output:

PLAY [localhost] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK: [debug var=true\_eval] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost] =\> {  
“true\_eval”: “True”  
}

TASK: [debug var=False] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost] =\> {  
“False”: “False”  
}

TASK: [debug var=false\_eval] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost] =\> {  
“false\_eval”: “False”  
}

TASK: [debug var=False] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost] =\> {  
“False”: “False”  
}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
localhost : ok=4 changed=0 unreachable=0 failed=0

Ansible 1.4.4

Thanks
