Ansible installation on rhel7
Facing issue while installing ansible on Rhel 7 and couldn't find dependencies of python
Attachments
Responses
Ansible can now be found in rhel-7-server-extras-rpms along with the required dependencies.
Make sure you have that repository enabled.
Rakesh, you would need to manually pull up the list of dependent packages along with ansible and download using "yumdownloader" and then transfer all these files to system where it is outside of internet connectivity and install it. Most of the dependent packages are from python as shown in the below snippet:
This I had done for testing purpose on rhel7.4 beta release server.
Ansible>yum history info 6
Transaction ID : 6
Begin time : Thu Jul 27 09:48:05 2017
Begin rpmdb : 1280:9b883caf35375212aa23456717399c2d974ec08a
End time : 09:48:22 2017 (17 seconds)
End rpmdb : 1300:05228d974925912982079a38faa4de5abbdedd8c
User : root <root>
Return-Code : Success
Command Line : install ansible
Transaction performed with:
Installed rpm-4.11.3-21.el7.x86_64 @server
Installed subscription-manager-1.17.15-1.el7.x86_64 @server
Installed yum-3.4.3-150.el7.noarch @server
Packages Altered:
Dep-Install PyYAML-3.10-11.el7.x86_64 @rhel-7-server-rpms
Install ansible-2.3.0.0-4.el7.noarch @rhel-7-server-extras-beta-rpms
Dep-Install libtomcrypt-1.17-25.el7.x86_64 @rhel-7-server-extras-beta-rpms
Dep-Install libtommath-0.42.0-6.el7.x86_64 @rhel-7-server-extras-beta-rpms
Dep-Install libyaml-0.1.4-11.el7_0.x86_64 @rhel-7-server-rpms
Dep-Install python-babel-0.9.6-8.el7.noarch @rhel-7-server-rpms
Dep-Install python-cffi-1.6.0-5.el7.x86_64 @rhel-7-server-rpms
Dep-Install python-enum34-1.0.4-1.el7.noarch @rhel-7-server-rpms
Dep-Install python-httplib2-0.9.1-3.el7.noarch @rhel-7-server-extras-beta-rpms
Dep-Install python-idna-2.0-1.el7.noarch @rhel-7-server-rpms
Dep-Install python-ipaddress-1.0.16-2.el7.noarch @rhel-7-server-rpms
Dep-Install python-jinja2-2.7.2-2.el7.noarch @rhel-7-server-rpms
Dep-Install python-markupsafe-0.11-10.el7.x86_64 @rhel-7-server-rpms
Dep-Install python-paramiko-2.1.1-2.el7.noarch @rhel-7-server-extras-beta-rpms
Dep-Install python-ply-3.4-10.el7.noarch @rhel-7-server-rpms
Dep-Install python-pycparser-2.14-1.el7.noarch @rhel-7-server-rpms
Dep-Install python2-crypto-2.6.1-15.el7.x86_64 @rhel-7-server-extras-beta-rpms
Dep-Install python2-cryptography-1.3.1-3.el7.x86_64 @rhel-7-server-rpms
Dep-Install python2-pyasn1-0.1.9-7.el7.noarch @rhel-7-server-rpms
Dep-Install sshpass-1.06-2.el7.x86_64 @rhel-7-server-extras-beta-rpms
Rakesh,
The issue is that you are attempting to install Ansible using the 'rpm -ivh' command, which means that it won't use the yum depsolver to resolve depdencies that it needs.
You should be installing the rpm (even if you downloaded it locally, and it's in a local directory) using yum so it can attempt to use your configured repositories for dependency resolution.
yum install ansible-2.3.1.0-1.el7.noarch.rpm
I also see you attempted pip install. You need to decide if you are using pip or the rpm package manager to install/manage Ansible in your environment. I would definitely recommend/suggest you use the rpm that is shipped/provided by Red Hat.
What would be the proper (maintainable) way to have several versions of ansible available on the same RHEL 7 based ansible management server?
(Ansible 2.4 broke compatibility with older Python versions on target systems, thus it could be nice to have 2.3 for those; all of them "can not" be upgraded to have more current Python.)
I'm handling this using docker. I create an Ansible container for each major release through a CI process that pulls from pypi, this way all the dependencies for a specific version are all captured.
These are basically containers used for executing Ansible on the Ansible server and are destroyed after every execution (logs are shipped and stored in a SIEM).
The other benefit is that we can move Ansible version up and all CI pipelines that depend on Ansible don't all have to move at the same time because they specify the container version they need to execute in.
Result looks like this:
# docker images | grep ansible
ansible 2.4.3 0e8080488e7c 23 hours ago 358 MB
ansible 2.4.2 a0d4fe2eabb7 3 days ago 358 MB
# docker run ansible:2.4.2 ansible --version
ansible 2.4.2.0
config file = None
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, May 29 2017, 20:42:36) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]
# docker run ansible:2.4.3 ansible --version
ansible 2.4.3.0
config file = None
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, May 29 2017, 20:42:36) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]
We can also run and test the Alpha (eg. 2.5.0a) and other builds without impacting any of the running configuration/infrastructure.
Thanks for the suggestion! We ended up using virtualenv instead, like so:
virtualenv ansible23
source ansible23/bin/activate
pip install --upgrade pip # to avoid problems with ansible dependencies
pip install ansible==2.3.3.0
To use this version of ansible we just source again the specific activation script.
-Tom
Tom,
Looks good!
I have used virtualenv for similar in the past but found that the 'spin up' time of the virtualenv was a little too long, especially when dragging in lists of dependencies and when 'spinning up' virtualenv environments on demand.
$ time virtualenv empty
New python executable in /tmp/empty/bin/python
Installing setuptools, pip, wheel...done.
real 0m25.211s
user 0m1.955s
sys 0m0.510s
Initialisation times aside (and if you are using the same virtualenv multiple times this isn't an issue), I agree this is a great approach to achieve the outcome.
Interestingly, it looks like I am not the only one that has headed down the Docker path for bundling Ansible Playbooks (nothing is new in this world). The 'APB' (Ansible Playbook Bundle) project/concept being run by the Openshift team looks to take it a step further by bundling each specific playbook and its dependencies into a container that follows a standard convention with a standard entry point and parameters.
https://github.com/ansibleplaybookbundle/ansible-playbook-bundle
I really like this approach because the APB's can be built/tested out of band, pushed to a container registry and pulled by a production system when a specific task/playbook needs to be executed.
I am working on using APB's without the Openshift requirement at the moment.
Hi Daniele,
If you have a Satellite server then it is possible, you will need the rhel7 extra repository. The one named in this discussion already comes from Satellite 6.x. A Satellite 5.y repository (named channel) has a slight different name, still it works.
Regards,
Jan Gerrit P.S. I installed an Ansible server using a Satellite 6.2.14 server.
Hi Jan,
Sorry, my problem is Ansible Tower.
I already have that repository. What happens is that when the installation begins, other repositories that do not locate them in satellite are automatically added and try to search them on the Internet. These are: ansible-el7.repo ansible-tower.repo laska-rabbitmq.repo pgdg-96-centos.repo
What I can do? I add them to Satellite? Is there another way? Look at this document -> https://blog.confirm.ch/ansible-tower-offline-installation-on-a-red-hat-system/
I know the Tower discussion has moved to another thread.. but I wanted to say the Ansible Tower installer definitely has unique issues as the product was acquired from another vendor, and pulls in a list of deps/rpms for versions of the products not supported in core RHEL.
In the past I have provided feedback to Red Hat (and Ansible engineering) about the install process of Tower raising that it definitely needs some attention.
Another issue I had (in case people find this thread) is that the Tower install won't work if you have /var mounted noexec as it runs several services from a /var location.
On AWS, maybe you should be use (without subscription-manager) ,
To activate repo : yum-config-manager --enable 'rhui-REGION-rhel-server-extras'
For just install one package without activate in permanent: yum --enable 'rhui-REGION-rhel-server-extras' install ansible
Hi Daniele,
You can download the package by using the Red Hat Package Browser and install it manually. :)
Regards,
Christian
Hi, This is Madhushree B. I am getting the error a follows when I type the command yum -u install ansible on RHEL7.
failure: repodata/repomd.xml from rhel-7-server-extras-beta-rpms: [Errno 256] No more mirrors to try. https://cdn.redhat.com/content/beta/rhel/server/7/x86_64/extras/os/repodata/repomd.xml: [Errno 14] HTTPS Error 403 - Forbidden
Can you please help me out.
I have an issue installing ansible 2.6 on RH 7.4. Appreciate any assistance
details below.
host > yum repolist all
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
repo id
!org_XXX_EPEL-7_EPEL-7 enabled: 12,662
!rhel-7-server-ansible-2.6-rpms/x86_64 enabled: 9
!rhel-7-server-extras-rpms/x86_64 enabled: 901
!rhel-7-server-rh-common-rpms/7Server/x86_64 enabled: 233
!rhel-7-server-satellite-tools-6.3-rpms/x86_64 enabled: 88
!rhel-7-server-supplementary-rpms/7Server/x86_64 enabled: 279
repolist: 14,172
]# yum install ansible --> Finished Dependency Resolution
Error: Package: python-paramiko-2.1.1-4.el7.noarch (rhel-7-server-ansible-2.6-rpms) Requires: python2-pyasn1
Error: Package: python-paramiko-2.1.1-4.el7.noarch (rhel-7-server-ansible-2.6-rpms) Requires: python-cryptography
Error: Package: ansible-2.6.3-1.el7ae.noarch (rhel-7-server-ansible-2.6-rpms) Requires: PyYAML
Error: Package: python-jinja2-2.7.2-2.el7.noarch (rhel-7-server-extras-rpms) Requires: python-babel >= 0.8
Error: Package: ansible-2.6.3-1.el7ae.noarch (rhel-7-server-ansible-2.6-rpms) Requires: python-cryptography
Error: Package: python-jinja2-2.7.2-2.el7. noarch (rhel-7-server-extras-rpms) Requires: python-markupsafe
You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
