# casting to bool not working

**URL:** <https://forum.ansible.com/t/casting-to-bool-not-working/19380>\
**Category:** Ansible Project\
**Created:** [September 29, 2015, 10:02pm UTC](https://forum.ansible.com/t/casting-to-bool-not-working/19380 "2015-09-29T22:02:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Javeria\_Khan](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@Javeria\_Khan](https://forum.ansible.com/u/Javeria_Khan)\
**Post date:** [September 29, 2015, 10:02pm UTC](https://forum.ansible.com/t/casting-to-bool-not-working/19380/1 "2015-09-29T22:02:49Z")

</div>

Hi,

I’ve got a dict value that is supposed to evaluate a boolean parameter like so:

var1: False  
var2: True

my\_dict:

- {a1: “{{ var1|bool }}”}
- {a2: “{{ var2|bool }}”}

However the original True/False values always get evaluated as strings eventually, typecasting doesn’t seem to be working. I’m on ansible 1.9.3.

Output from debug

ok: [host1] =\> (item={‘a1’: u’False’})
