How to switch your ansible version in the same env?
Ansible is just a python package,if you have virtualenv installed on your host it is just a matter of creating a new venv for each ansible version you want, and then pip install it.
First, verify the installed Python version and path. Create a virtual environment using the python3 -m venv <environment-name> command
. You can give any name to your Python virtual environment. I want to try the Ansible 2.10 version, so I named it in a way to identify the directory easily:
$mkdir ~/venvs/
$cd !$
$python3 -m venv ansible2.10
$source ansible2.10/bin/activate
$pip install "ansible==2.10" --user
$ansible --version
ansible 2.10.17
$deactivate
More details: