In this recipe, we will outline how to install Ansible in a Python virtual environment in order to have an isolated and contained environment for developing and running our playbooks.
Python 3 must be already installed on your Linux machine.
- Create a new Python virtual environment called dev, and activate it as follows:
$ python3 -m venv dev
$ source dev/bin/activate
- Install Ansible in this new virtual environment, as follows:
$ (dev) $ pip3 install ansible==2.9