diff --git a/lib/ansible/utils/template.py b/lib/ansible/utils/template.py index 3e7f5e4d81..0098aa8b89 100644 --- a/lib/ansible/utils/template.py +++ b/lib/ansible/utils/template.py @@ -93,6 +93,8 @@ def lookup(name, *args, **kwargs): ran = instance.run(*args, inject=tvars, **kwargs) except errors.AnsibleError: raise + except jinja2.exceptions.UndefinedError, e: + raise errors.AnsibleUndefinedVariable("One or more undefined variables: %s" % str(e)) except Exception, e: raise errors.AnsibleError('Unexpected error in during lookup: %s' % e) if ran: