ok, the default using an array was wrong.

This works:

{ role: somerole, when: foo | default('') == 'bar' }

On Tuesday, April 7, 2015 at 2:59:25 PM UTC+1, ddffgpmfn wrote:
>
> Goal: conditionally apply a role, but not be required to define the var in 
> every target env.
>
> Can I default a var to empty or null if it isn't defined as 'bar'? e.g:
>
>> - { role: somerole, when: foo == 'bar' | default([]) }
>
>

-- 
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/1a9749d8-d493-4a20-8ef2-2ca27b82ae32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to