On Tuesday, December 19, 2017 at 6:05:50 AM UTC, Kai Stian Olstad wrote:
>
> On 13.12.2017 12:55, Mike C wrote: 
> > Hi all, 
> > 
> > im trying to use a 'complex' expression to evaluate if a task should 
> > run as 
> > root or not. 
> > 
> > Here is what i have defined: 
> > 
> > ``` 
> > debian_based_system: ansible_os_family == 'Debian' or ansible_os_family 
> > == 
> > 'Linuxmint' 
> > ``` 
>
> You don't say where you define this, but debian_based_system is 
> literally equal to the string 
> ansible_os_family == 'Debian' or ansible_os_family == 'Linuxmint' 
>
> I thing you are trying to make debian_based_system true or false, to do 
> this you need to enclose them in expression syntax {{ }} 
>
> ansible_os_family == "{{ 'Debian' or ansible_os_family == 'Linuxmint' 
> }}" 
>
>
> -- 
> Kai Stian Olstad 
>


Thanks for the reply. 

> You don't say where you define this
I define this in `defaults/main.yml`. I didnt mention it as im not sure how 
that could make a difference.

> I thing you are trying to make debian_based_system true or false, to do 
> this you need to enclose them in expression syntax {{ }} 

> ansible_os_family == "{{ 'Debian' or ansible_os_family == 'Linuxmint' 
}}" 

im failing to see how what you are suggesting is different to what i've 
mentioned already with:

> If i change the definition to `debian_based_system: '{{ ansible_os_family 
== "Debian" or ansible_os_family == "Linuxmint" }}'`,

This gives me a warning 'when statements should not include jinja2 
templating delimiters'

Cheers,
Mike

-- 
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/c33a6c20-a58a-4ea2-b00b-6919638e1060%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to