Multiple ansible versions with python virtualenv
TL;DR export ANSIBLE_VERSION=x.x.x mkdir -p ~/ansible_venv cd ~/ansible_venv python3 -m venv ansible${ANSIBLE_VERSION} source ansible${ANSIBLE_VERSION}/bin/activate pip install --upgrade pip setuptools pip install ansible==${ANSIBLE_VERSION} ansible-lint netaddr pbr hvac jmespath passlib bcrypt . ~/ansible_venv/ansible${ANSIBLE_VERSION}/bin/activate Long story Install python3-venv package: sudo apt install python3-venv Create an ~/ansible_venv directory: mkdir ~/ansible_venv From ~/ansible_venv directory, create your virtual ansible environment: e.g for ansible 2.9.16: python3 -m venv ansible2.9.16 Once this environment created, activate it: source ansible2.9.16/bin/activate You will see your shell has changed, with name of virtualenv you are currently using....