Greetings,
I have a playbook which includes this piece…
When run I get this error message
TASK [EPEL : Install the appropriate EPEL package for RHEL/OEL] ****************
fatal: [host]: FAILED! => {“changed”: false, “failed”: true, “msg”: “No Package matching ‘https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm’ found available, installed or updated”, “rc”: 0, “results”: }
If I run it on the target server manually I get
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Loaded plugins: product-id, search-disabled-repos, subscription-manager
epel-release-latest-7.noarch.rpm | 14 kB 00:00
Examining /var/tmp/yum-root-NZVCS_/epel-release-latest-7.noarch.rpm: epel-release-7-6.noarch
Marking /var/tmp/yum-root-NZVCS_/epel-release-latest-7.noarch.rpm to be installed
Resolving Dependencies
blahblahblah
I’m running Ansible 2.0.2.0
Any ideas?
I think you can avoid this altogether.
I believe there’s an epel-release package in the main yum repo which you can use to add EPEL to your yum sources (may not have the right terminology here).
- name: ADD EPEL release using a yum package to do so
yum:
name: epel-release
state: present
Hope this helps,
Jon
Thanks Jon,
Unfortunately that package is available for CentOS not Red Hat Enterprise Linux or Oracle Enterprise Linux.
While it is unlikely that I will be installing many RPMs from a URL I would like to know why it isn't working here.
In my situation the real solution will be to set up my own local repositories and install from those but I am curious as to what I am doing wrong here.
Adam
I think it is telling you literally what is wrong. It is trying to
install a package named:
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
which it isn't finding in any of the yum repositories it knows about.
I think you need to do this in a two stage process.
1) Download the file from
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
2) Then install the file.
To quote from the module documentation page for yum...
Package name, or package specifier with version, like name-1.0. When using state=latest, this can be '*' which means run: yum -y update. You can also pass a url or a local path to a rpm file (using state=present). To operate on several packages this can accept a comma separated list of packages or (as of 2.0) a list of packages.
To me that suggests that that should work...
rereading this I spotted where I went wrong... With a URL you have to use state as present not latest. I have changed that and this works.
Thanks everyone.
Adam
What happens when you use state=present instead of latest? Latest
means it looks for newer version of the package, even if it is
installed. I think this could collide with installing from a url
(where no version info is available).
Johannes
Greetings Johannes,
I spotted that in the documentation and you are right. For deployment from a URL you have to use state=present.
Thanks for responding,
Adam