diff --git a/lib/ansible/playbook/conditional.py b/lib/ansible/playbook/conditional.py index 844f8ee3867..c7c22119a50 100644 --- a/lib/ansible/playbook/conditional.py +++ b/lib/ansible/playbook/conditional.py @@ -22,6 +22,7 @@ __metaclass__ = type import ast import re +from jinja2.compiler import generate from jinja2.exceptions import UndefinedError from ansible.compat.six import text_type @@ -123,7 +124,7 @@ class Conditional: presented = "{%% if %s %%} True {%% else %%} False {%% endif %%}" % conditional res = e._parse(presented, None, None) - res = e._generate(res, None, None, defer_init=True) + res = generate(res, e, None, None) parsed = ast.parse(res, mode='exec') class CleansingNodeVisitor(ast.NodeVisitor):