diff --git a/lib/ansible/runner/filter_plugins/core.py b/lib/ansible/runner/filter_plugins/core.py index f44089c750..1cd53bbaa3 100644 --- a/lib/ansible/runner/filter_plugins/core.py +++ b/lib/ansible/runner/filter_plugins/core.py @@ -76,9 +76,12 @@ def skipped(*a, **kw): def mandatory(a): ''' Make a variable mandatory ''' - if not a: + try: + a + except NameError: raise errors.AnsibleFilterError('Mandatory variable not defined.') - return a + else: + return a def bool(a): ''' return a bool for the arg '''