use default during conditional role statement?

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:

ok, the default using an array was wrong.

This works:

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