We're using Ansible for a lot of our deployments. This agent-less configuration management tool requires almost no overhead, and this low barrier 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 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 is a need to use 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.
Enter Python's virtualenv.
This allows you to isolate a complete python environment, and install a specific version of Ansible. With the help of some bash aliases you can conveniently switch between all versions.
Assuming you have the required basic tools available, run this bash script:
When this finishes, open up a new terminal and start typing ansible-activate
and use tab completion to pick the specific version
This works for Linux distros as well - each distro does require it's own preparations:
Distro | Requirements |
---|---|
CentOS7 |
|
1 Comment
Anonymous
Brilliant solution. Thank you!