geerlingguy / ansible-role-repo-epel

Ansible Role - EPEL Repository for RHEL/CentOS
https://galaxy.ansible.com/geerlingguy/repo-epel/
MIT License
186 stars 148 forks source link

Don't install repo if it is already installed #16

Closed vinceatbluelabs closed 8 years ago

vinceatbluelabs commented 8 years ago

Hi!

Amazon Linux is a RHEL derivative used in AWS. Sounds like it forked at RHEL 5, but contains many packages of RHEL 6 at the moment. Unfortunately, this role fails on it today. This PR should address that.

Details:

Ansible returns 'NA' for ansible_distribution_major_version (understandably), and so this fails in defaults/main.yml:

  epel_repo_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
  epel_repo_gpg_key_url: "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}"

That said, Ansible Linux comes with EPEL pre-installed (just disabled by default), so this changes the check to verify whether the epel.repo file exists and skip the installation entirely if it's there.

This may be better behavior regardless for follow-up runs of the same role.

Take a look and let me know what you think!

vinceatbluelabs commented 8 years ago

Take a look at let me know what you think. Thanks!

vinceatbluelabs commented 8 years ago

Hi! Any thoughts?

geerlingguy commented 8 years ago

Moving final work to #17.