Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It is impractical to refactor large projects to work with the latest Ansible version, so there is a need to use to specific Ansible versions for specific deployments.

On MacOS I use the HomeBrew package manager to provide me with Ansible, and this works OK. Switching between different Ansible versions is possible, but in practise this is only works if you have cached the old version, i.e. you have been installing and updating versions continuously. Picking a random older version is very tedious at best.

...

Assuming you have the required basic tools available, install this in your home directoryrun this bash script:

Code Blockhtml
mkdir ~/.virtualenvs
virtualenv ~/.virtualenvs/ansible-2.3.3
source ~/.virtualenvs/ansible-2.3.3/bin/activate
pip install ansible==2.3.3
deactivate

Repeat this for every version you want to be able to use.

Then add a line like this to your .bash_profile for each version:

Code Block
alias ansible-activate-2.3.3="source ~/.virtualenv/ansible-2.3.3/bin/activate"
<script src="https://gitlab.com/snippets/1769242.js"></script>


When this finishes, open up a new terminal and start typing ansible-activate You can just type ansible-activate and use tab completion to pick the specific version.

Obviously you can use ansible to install ansible - for instance onto a deployment VM or bastion host:

...

languagebash
themeMidnight

...

version (smile)

This works for Linux distros as well - each distro does require it's own preparations:

DistroRequirements
CentOS7
sudo yum install gcc libffi-devel python-devel openssl-devel python-virtualenv

...