Comments 31 Posted In Red Hat Enterprise Linux Ansible installation on rhel7 Latest response 2020-09-12T00:05:37+00:00 Facing issue while installing ansible on Rhel 7 and couldn't find dependencies of python Attachments redhat.docx Ru Started 2017-08-11T18:24:12+00:00 by Rakesh uppalapati Community Member 20 points Log in to join the conversation Responses Sort By Oldest Sort By Newest MP Community Member 25 points 11 August 2017 7:19 PM Morgan Peterman Ansible can now be found in rhel-7-server-extras-rpms along with the required dependencies. Make sure you have that repository enabled. Ru Community Member 20 points 11 August 2017 8:24 PM Rakesh uppalapati i cant enable the repositories as it was company managed servers Guru 23900 points 12 August 2017 1:14 PM Christian Labisch Community Leader Hi Rakesh, Assuming that you are allowed to use Ansible on the server, ask the system admin to enable the repo. Regards, Christian Ru Community Member 20 points 11 August 2017 8:24 PM Rakesh uppalapati how to enable the repository Guru 23900 points 12 August 2017 1:08 PM Christian Labisch Community Leader Hi Rakesh, Open a terminal and execute : sudo subscription-manager repos --enable rhel-7-server-extras-rpms Cheers :) Christian Ru Community Member 20 points 11 August 2017 8:32 PM Rakesh uppalapati Ansible Installations http://docs.ansible.com/ansible/latest/intro_installation.html Traceback (most recent call last): File "./ansible", line 40, in import ansible.constants as C ImportError: No module named ansible.constants SM Guru 6155 points 12 August 2017 11:41 AM Sadashiva Murthy M 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-184.108.40.206-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 Guru 6603 points 15 August 2017 3:42 AM pixdrift Community Leader 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-220.127.116.11-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. Active Contributor 144 points 8 February 2018 2:07 PM Tom Söderlund 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.) Guru 6603 points 9 February 2018 12:53 AM pixdrift Community Leader 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 18.104.22.168 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 22.214.171.124 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. Active Contributor 144 points 15 March 2018 12:26 PM Tom Söderlund 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==126.96.36.199 To use this version of ansible we just source again the specific activation script. -Tom Guru 6603 points 15 March 2018 10:44 PM pixdrift Community Leader 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. Red Hat Community Member 41 points 22 March 2018 8:09 PM Daniele Stefenello Hello everyone. Did any of you install Ansible without an Internet connection only with the satellite repositories? Can this be done? Guru 10256 points 22 March 2018 8:20 PM ir. Jan Gerrit Kootstra Community Leader 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. Red Hat Community Member 41 points 22 March 2018 9:11 PM Daniele Stefenello 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/ Guru 10256 points 22 March 2018 9:24 PM ir. Jan Gerrit Kootstra Community Leader Hello Daniele, Please open a new Discussion, for Tower is a little different product. The supported release needs it's own subscription. I do not have one, so cannot help you. Regards, Jan Gerrit Red Hat Community Member 41 points 22 March 2018 11:25 PM Daniele Stefenello Thanks to everyone for your support. I opened another discussion -> https://access.redhat.com/discussions/3390401 Guru 6603 points 23 March 2018 1:45 AM pixdrift Community Leader 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. Guru 14968 points 24 March 2018 5:59 PM RJ Hinton Community Leader I put in a case for Ansible (but not tower) regarding rpm availability for workstation where it doesn't seem to appear in the workstations extras channels. I found it easily enough in the extras rpms for server but not for workstation. AM Community Member 90 points 24 April 2018 3:00 PM Aymeric Marchal 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 Guru 23900 points 24 April 2018 4:46 PM Christian Labisch Community Leader Hi everybody, The repository has changed with the release of RHEL 7.5 - ansible is now available from rhel-7-server-ansible-2.5-rpms. To enable this repository, just execute sudo subscription-manager repos --enable rhel-7-server-ansible-2.5-rpms. Regards, Christian Red Hat Community Member 41 points 19 June 2018 12:55 AM Daniele Stefenello Hi, Great news. How can I install it on a rhel 7 csb workstation that does not have a subscription manager? Thank you, Daniele.- Guru 23900 points 19 June 2018 7:47 AM Christian Labisch Community Leader Hi Daniele, You can download the package by using the Red Hat Package Browser and install it manually. :) Regards, Christian DN Community Member 34 points 10 October 2018 6:18 PM David Niemi Christian, Thank you! I could not figure out why Ansible wasn't updating past version 2.4. David MB Newbie 5 points 22 June 2018 10:57 AM Madhushree B 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. Guru 23900 points 22 June 2018 11:32 AM Christian Labisch Community Leader Hi Madhushree, Disable the beta repo : sudo subscription-manager repos --disable rhel-7-server-extras-beta-rpms In case you need the extras-beta repo at some later time, you can re-enable it. Ansible is available from another repo. Regards, Christian DC Newbie 5 points 30 August 2018 6:10 AM Dexter Cardones 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 SM Guru 6155 points 30 August 2018 7:01 AM Sadashiva Murthy M You've not enabled 'rhel-7-server-rpms' repository, enable this repo and then run yum install, it should work. Red Hat Newbie 16 points 27 December 2018 8:50 PM Kartik Mishra Can ansible be installed on RHEL 6 systems? Guru 14968 points 27 December 2018 9:53 PM RJ Hinton Community Leader I've noted that for RHEL workstation, EPEL seems to contain the necessary ansible & sshpass rpms. The location for ansible on server was discussed earlier. Like Pixeldrift said, use yum, not rpm. Where I work, we routinely download our own EPEL and keep it updated for our isolated networks. -RJ AE Newbie 7 points 12 September 2020 12:05 AM Ann Engström Hi I am unable to update the ansible package through yum update --advisory.Kindly please give me suggestions how to update the ansible package.I was implemented to erase pervious package.try to install the let-east package.still the package installing to old version.