On Wednesday, December 20, 2017 at 11:21:22 AM UTC, Mike C wrote:
>
>
>
> 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
>
I think this is fixed with https://github.com/ansible/ansible/pull/25092,
so ill ignore the warnings for now and then fix them when i update ansible
version.
--
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/88a60b45-07f9-42b0-b201-970bd8cf36ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.