jinja/ansible convert string to boolean

Viewed 12975

I need the simple thing - if variable is false or empty string, then evaluate to false. Otherwise evaluate to true.

I tried bool(var) but I'm getting:

UndefinedError: 'bool' is undefined

Then I tried var | bool but even though var is non-empty, that evaluates to false. How to make that condition work??

2 Answers
Related