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.

On Thursday, 7 December 2017 10:23:58 UTC, Kai Stian Olstad wrote:
>
> On 07.12.2017 11:18, jepper wrote: 
> > The snippet below evaluates to true, then false with myvar=false. How 
> > come? 
> > ansible version 2.2.1.0 on OSX High Sierra 
> > 
> > --- 
> > - 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 }}" 
>
> You can't use double curly brackets in when, in when you are in template 
> mode already so the double curly brackets is implied. 
>
>
> -- 
> Kai Stian Olstad 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c406a377-09cc-435b-a687-4b446b1cb64b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to