bool and string evaluation gives mixed result if using curly brackets

The snippet below evaluates to true, then false with myvar=false. How come? ansible version 2.2.1.0 on OSX High Sierra

You can't use double curly brackets in when, in when you are in template mode already so the double curly brackets is implied.

The problem is that when: “{{ something == ‘yes’ and myvar }}” yields the desired result e.g.:

ansible-playbook play.yml -c local -i 127.0.0.1, -e myvar=true -e something=“yes”

PLAY [do stuff with curlies] ***************************************************
changed: [127.0.0.1]

I will go ahead and use “myvar | bool” everywhere as that too works.

The problem is that when: "{{ something == 'yes' and myvar }}" yields the
desired result e.g.:

ansible-playbook play.yml -c local -i 127.0.0.1, -e myvar=true -e
something="yes"
PLAY [do stuff with curlies]
***************************************************
changed: [127.0.0.1]

That's just luck since Jinja doesn't support stacked curly brackets.

I will go ahead and use "myvar | bool" everywhere as that too works.

Variables values on the command line become strings so you would need to filter it with bool or check for the actual string.