diff --git a/changelogs/fragments/jinja2_native-fallback-warning.yaml b/changelogs/fragments/jinja2_native-fallback-warning.yaml new file mode 100644 index 00000000000..ec60a04323a --- /dev/null +++ b/changelogs/fragments/jinja2_native-fallback-warning.yaml @@ -0,0 +1,2 @@ +minor_changes: + - Add warning about falling back to jinja2_native=false when Jinja2 version is lower than 2.10. diff --git a/lib/ansible/template/__init__.py b/lib/ansible/template/__init__.py index e7de0f893d5..e336860b4e1 100644 --- a/lib/ansible/template/__init__.py +++ b/lib/ansible/template/__init__.py @@ -74,6 +74,11 @@ if C.DEFAULT_JINJA2_NATIVE: except ImportError: from jinja2 import Environment from jinja2.utils import concat as j2_concat + from jinja2 import __version__ as j2_version + display.warning( + 'jinja2_native requires Jinja 2.10 and above. ' + 'Version detected: %s. Falling back to default.' % j2_version + ) else: from jinja2 import Environment from jinja2.utils import concat as j2_concat