Versions Compared

Key

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

We're using Ansible for a lot of our deployments. This agent-less configuration management tool requires almost no overhead, and this low barrier of entrance to entry enables people from our community to contribute deployment code. So far so good.

The Ansible code has seen a few major changes over the last years, which unfortunately causes cause some features to change, disappear, or even break.

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

On my MacOS computer I usually use the HomeBrew package manager , which to provide me with Ansible, and this works OK for Ansible. Switching between different Ansible versions is possible, but in practise this is only possible 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.

...

This allows you to isolate a complete python environment, and install a specific version of Ansible. With the help of some bash aliases this you can be conveniently automatedswitch between all versions.

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 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

...