As products and technologies evolve so does how older releases are supported. That is cool right except it is hard to move from older releases due to application constraints, lack of 3rd party certification for the newer release or a for a number of reasons.
This can add to the complexity, How do you support the new and the old. Ansible Tower is here to help. One of the newer features of Ansible Tower is support for multiple env. This means you can create custom environments to support your newer and older environments using the same Tower Install. The basic Information is Here but I will demo this for you in a step by step process.
I have a Tower 3.3 Install and a RHEL 5 VM that i would like to manage with my Tower Environment
All the Steps happen in the Tower Server and if you have a clustered Tower environment you will need to move this to all the Tower servers. I’m using rhel51 as my virtual env. This can be changed to anything that you want
[root@rhel75_tower ~]# cd /var/lib/awx/venvroot@rhel75_tower venv]# mkdir rhel51
We will then Intialize the virtual Environment
[root@rhel75_tower venv]# sudo virtualenv /var/lib/awx/venv/rhel51
New python executable in /var/lib/awx/venv/rhel51/bin/python
Installing setuptools, pip, wheel…done.
This has Intialized the Virtual Environment. After this, we will install dependencies that Tower needs in the new virtual environment.
[root@rhel75_tower venv]# sudo /var/lib/awx/venv/rhel51/bin/pip install python-memcached psutil
Using cached https://files.pythonhosted.org/packages/f5/90/19d3908048f70c120ec66a39e61b92c253e834e6e895cd104ce5e46cbe53/python_memcached-1.59-py2.py3-none-any.whl
Requirement already satisfied: six>=1.4.0 in ./rhel51/lib/python2.7/site-packages (from python-memcached)
Installing collected packages: python-memcached, psutil
Successfully installed psutil-5.4.7 python-memcached-1.59
Since we know based on the doc here that Ansible 3 supports RHEL 5 we will setup the virtual environment with ansible 2.3
[root@rhel75_tower venv]# sudo /var/lib/awx/venv/rhel51/bin/pip install -U “ansible == 2.3”
Collecting PyYAML (from ansible==2.3)
Collecting jinja2 (from ansible==2.3)
Installing collected packages: PyYAML, MarkupSafe, jinja2, idna, enum34, six, pycparser, cffi, ```asn1crypto, ipaddress, cryptography, pynacl, pyasn1, bcrypt, paramiko, pycrypto, setuptools, ```ansible
Found existing installation: setuptools 28.8.0
Successfully uninstalled setuptools-28.8.0
This Successfully Creates a virtual environment that can then be used to support a RHEL 5 Environment from Tower 3.3
We can assign Custom Virtual Environments either in the config file or using the Tower interface . I will use Tower’s UI to assign a virtual env to a job template. Below is how the custom virtualenv is assigned at a project level. The image below shows where the virtual environment is setup and what a job looks like when it executes against a non supported version
Now Since we have created a virtual Environment lets assign it to a project and create a job template. The images below show a project with the new virtual environment and a job template that is using a custom environment.
Now lets execute this custom environment based job template against my RHEL5 VM. As you can see form the image below the job was successful running from Tower 3.3 using ansible 2.3 on a RHEL 5 VM
Hopefully this post has helped you see how Ansible Tower can help you manage you new and old with the same install and ensure your dependencies are segregated in different
virtualenv which helps you control what you are executing where . if you need more information about Ansible or give Ansible Tower a Whirl go to https://www.ansible.com