diff --git a/changelogs/fragments/dict_is_dict.yml b/changelogs/fragments/dict_is_dict.yml new file mode 100644 index 0000000000..53076782ff --- /dev/null +++ b/changelogs/fragments/dict_is_dict.yml @@ -0,0 +1,2 @@ +bugfixes: + - allow 'dict()' jinja2 global to function the same even though it has changed in jinja2 versions diff --git a/lib/ansible/template/__init__.py b/lib/ansible/template/__init__.py index 066c2573e5..19fb520451 100644 --- a/lib/ansible/template/__init__.py +++ b/lib/ansible/template/__init__.py @@ -726,6 +726,9 @@ class Templar: else: return data + # jinja2 global is inconsistent across versions, this normalizes them + t.globals['dict'] = dict + if disable_lookups: t.globals['query'] = t.globals['q'] = t.globals['lookup'] = self._fail_lookup else: