Interview Prep/Ansible/Vault, Performance and Execution Behaviour

`ERROR! Unexpected Exception, this is probably a bug: cannot import name 'environmentfilter' from 'jinja2'`

AdvancedTroubleshootingVault, Performance and Execution Behaviour
Answer

Likely causes → An old Ansible (2.9 or 2.10) runs with Jinja2 3.1 or newer, which removed environmentfilter. This usually happens after pip install -U pulled new dependencies into a shared environment.

Diagnose → ansible --version shows the Python path. Then run <that python> -m pip show jinja2 ansible-core.

Fix → The real fix is to upgrade to a supported ansible-core. As a stopgap, pin jinja2<3.1 in that virtualenv.

Prevent → Run Ansible from a dedicated virtualenv or execution environment with locked dependencies (pip-compile, an EE image tag), never from the system Python.

All Ansible questions Roadmap: Ansible

More on Vault, Performance and Execution Behaviour