How to downgrade Ansible engine on RHEL 7 / CentOS 7 ?. If you install ansible engine from EPEL repository, it will install the latest ansible engine. I had a hard time with latest ansible engine due to incompatibility with specific tasks. For example, Openshift deployment works fine with Ansible engine 2.7 and fails with 2.8 version. In such cases, we need to downgrade the ansible engine version to the desired one. This article will walk you through how to downgrade the ansible engine version from 2.8 to 2.7.
Environment:
- RHEL 7 / CentOS 7
- EPEL repository configured.
- Ansible Engine version 2.8
1. Check the current ansible version.
[root@ansible-server ~]# ansible --version ansible 2.8.0 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /usr/bin/ansible python version = 2.7.5 (default, Apr 11 2018, 07:36:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] [root@ansible-server ~]#
2. To downgrade the ansible engine, we will use the pip. Ensure the pip2 (Package manager) is installed.
[root@ansible-server ~]# pip2 --version pip 19.0.3 from /usr/lib/python2.7/site-packages/pip (python 2.7) [root@ansible-server ~]#
3. To bring the ansible engine to 2.7.x again, you must use pip2 and specify the required ansible engine version.
[root@ansible-server ~]# pip install ansible==2.7.10 Collecting ansible==2.7.10 Downloading https://files.pythonhosted.org/packages/9a/9d/5e3d67bd998236f32a72f255394eccd1e22b3e2843aa60dc30dd164816d0/ansible-2.7.10.tar.gz (11.8MB) 100% |████████████████████████████████| 11.8MB 540kB/s Requirement already satisfied: jinja2 in /usr/lib/python2.7/site-packages (from ansible==2.7.10) (2.7.2) Requirement already satisfied: PyYAML in /usr/lib64/python2.7/site-packages (from ansible==2.7.10) (3.13) Requirement already satisfied: paramiko in /usr/lib/python2.7/site-packages (from ansible==2.7.10) (2.1.1) Requirement already satisfied: cryptography in /usr/lib64/python2.7/site-packages (from ansible==2.7.10) (2.3.1) Requirement already satisfied: setuptools in /usr/lib/python2.7/site-packages (from ansible==2.7.10) (40.8.0) Requirement already satisfied: markupsafe in /usr/lib64/python2.7/site-packages (from jinja2->ansible==2.7.10) (0.11) Requirement already satisfied: pyasn1>=0.1.7 in /usr/lib/python2.7/site-packages (from paramiko->ansible==2.7.10) (0.4.5) Requirement already satisfied: idna>=2.1 in /usr/lib/python2.7/site-packages (from cryptography->ansible==2.7.10) (2.7) Requirement already satisfied: enum34; python_version < "3" in /usr/lib/python2.7/site-packages (from cryptography->ansible==2.7.10) (1.1.6) Requirement already satisfied: six>=1.4.1 in /usr/lib/python2.7/site-packages (from cryptography->ansible==2.7.10) (1.10.0) Requirement already satisfied: cffi!=1.11.3,>=1.7 in /usr/lib64/python2.7/site-packages (from cryptography->ansible==2.7.10) (1.11.5) Requirement already satisfied: asn1crypto>=0.21.0 in /usr/lib/python2.7/site-packages (from cryptography->ansible==2.7.10) (0.24.0) Requirement already satisfied: ipaddress; python_version < "3" in /usr/lib/python2.7/site-packages (from cryptography->ansible==2.7.10) (1.0.22) Requirement already satisfied: pycparser in /usr/lib/python2.7/site-packages (from cffi!=1.11.3,>=1.7->cryptography->ansible==2.7.10) (2.19) Building wheels for collected packages: ansible Building wheel for ansible (setup.py) ... done Stored in directory: /root/.cache/pip/wheels/b1/87/37/8f982acaa4fd348505aa36789e2273ee362dbce98716d14cba Successfully built ansible Installing collected packages: ansible Found existing installation: ansible 2.8.0 Uninstalling ansible-2.8.0: Successfully uninstalled ansible-2.8.0 Successfully installed ansible-2.7.10 You are using pip version 19.0.3, however version 19.1.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. [root@ansible-server ~]#
If you get the SSL certificate error like below, use trusted flag.
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)’),)’:
Here is the command with the trusted flag to overcome the above error.
[root@ansible-server ~]# pip install --trusted-host files.pythonhosted.org --trusted-host pypi.org --trusted-host pypi.python.org ansible==2.7.10
4. Check the ansible engine version again.
[root@ansible-server ~]# ansible --version ansible 2.7.10 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /usr/bin/ansible python version = 2.7.5 (default, Apr 11 2018, 07:36:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] [root@ansible-server ~]#
We have successfully downgraded the ansible engine from 2.8 to 2.7 using pip (Pip Installs Packages).
HARSH YADAV says
u r awesome good job…..i want to install ansible of version 2.10.2 and I find the way here ….thanq
Mahesh says
ERROR! Your Ansible version (2.10.5) is too recent. The most recent version
supported by Mitogen for Ansible is (2, 9).x. Please check the Mitogen
release notes to see if a new version is available, otherwise
subscribe to the corresponding GitHub issue to be notified when
support becomes available.
https://mitogen.rtfd.io/en/latest/changelog.html
https://github.com/dw/mitogen/issues/
Mark says
Depending on your setup, this could be a horrendously bad idea. Under CentOS, combining PIP and the standard CentOS package manager will cause no end of grief. They don’t understand which package manager owns which packages, and at best will fail, or at worst totally mess up packages and their dependencies when trying to manage a package they do not own.