---
- name: do stuff without curlies
become: no
hosts: all
tasks:
- name: echo
shell: echo x
when: something == 'yes' and myvar
- name: do stuff with curlies
become: no
hosts: all
tasks:
- name: echo
shell: echo x
when: "{{ something == 'yes' and myvar }}"
$ ansible-playbook play.yml -c local -i 127.0.0.1, -e myvar=false -e something="yes"
PLAY [do stuff without curlies] ************************************************
TASK [echo] ********************************************************************
Thursday 07 December 2017 10:15:48 +0000 (0:00:00.080) 0:00:00.080 *****
changed: [127.0.0.1]
PLAY [do stuff with curlies] ***************************************************
TASK [echo] ********************************************************************
Thursday 07 December 2017 10:15:49 +0000 (0:00:00.470) 0:00:00.551 *****
PLAY RECAP *********************************************************************
127.0.0.1 : ok=1 changed=1 unreachable=0 failed=0