postgresql icon indicating copy to clipboard operation
postgresql copied to clipboard

"No package matching 'epel-release' found available, installed or updated" on RHEL7

Open tvigers opened this issue 7 years ago • 1 comments

Hi All,

When running the role against a RHEL7 host (not CentOS) the role fails when performing the following task:

      - name: PostgreSQL | Install all the required dependencies
        yum:
          name: ["ca-certificates","python-psycopg2", "python-pycurl", "glibc-common","epel-release","libselinux-python"]
          state: present

It is producing the following error message:

TASK [ANXS.postgresql : PostgreSQL | Install all the required dependencies] 
*********************************************************************************************************
fatal: [x.x.x.x]: FAILED! => {"changed": false, "failed": true, "msg": "No package matching 'epel-
release' found available, installed or updated", "rc": 126, "results": ["ca-certificates-2017.2.14-
71.el7.noarch providing ca-certificates is already installed", "python-pycurl-7.19.0-19.el7.x86_64 
providing python-pycurl is already installed", "glibc-common-2.17-196.el7_4.2.x86_64 providing glibc-
common is already installed", "No package matching 'epel-release' found available, installed or 
updated"]}

This is because 'epel-release' is available in the CentOS repositories however not available through the official Red Hat repo's.

To maintain compatibility with both CentOS and RHEL it would probably be better to have a separate task for enabling the EPEL repository.

I have been able to get it to work on RHEL by adding the following:

defaults/main.yml

postgresql_epel_release_base_url: "https://dl.fedoraproject.org/pub/epel" postgresql_epel_release_url: "{{ postgresql_epel_release_base_url }}/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"

tasks/install_yum.yml

   - block:
      - name: PostgreSQL | Install EPEL repository
        yum:
          name: "{{ postgresql_epel_release_url }}"
          state: present
      - name: PostgreSQL | Install all the required dependencies
        yum:
          name: ["ca-certificates","python-psycopg2", "python-pycurl", "glibc-common","libselinux-python"]
          state: present

It might also be better to use the yum_repository module for people who are using a local EPEL repo. I know at work we have ours in Red Hat Satellite. I guess it just depends on how much customisation you want to provide.

Cheers,

Tim

tvigers avatar Jul 02 '18 14:07 tvigers

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

github-actions[bot] avatar Feb 25 '24 23:02 github-actions[bot]

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

github-actions[bot] avatar Apr 25 '24 23:04 github-actions[bot]