Install EPEL from URL

This commit is contained in:
2021-05-06 09:46:31 +12:00
parent dcaee01c35
commit ad9a18ca20
2 changed files with 43 additions and 5 deletions

View File

@@ -1,4 +1,8 @@
---
# defaults file for repo-epel
epel_repo_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
epel_repo_gpg_key_url: "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}"
epel_repofile_path: "/etc/yum.repos.d/epel.repo"
epel_repo_disable: false
epel_specify_mirror: false
epel_mirror_url: http://download.fedoraproject.org/pub/epel

View File

@@ -1,9 +1,39 @@
---
# tasks file for repo-epel
- name: Ensure EPEL is installed
package:
name: epel-release
- name: Check if EPEL repo is already configured.
stat:
path: "{{ epel_repofile_path }}"
register: epel_repofile_result
- name: Import EPEL GPG key.
rpm_key:
key: "{{ epel_repo_gpg_key_url }}"
state: present
register: result
until: result is succeeded
retries: 5
delay: 10
when: not epel_repofile_result.stat.exists
ignore_errors: "{{ ansible_check_mode }}"
- name: Install EPEL repo.
yum:
name: "{{ epel_repo_url }}"
state: present
register: result
until: result is succeeded
retries: 5
delay: 10
when: not epel_repofile_result.stat.exists
- name: Disable Main EPEL repo.
ini_file:
path: "/etc/yum.repos.d/epel.repo"
section: epel
option: enabled
value: 0
mode: 0644
when: epel_repo_disable
- name: Configure Repository Settings (EL7)
template:
@@ -14,7 +44,9 @@
dest: /etc/yum.repos.d/epel.repo
- src: el7-epel-testing.repo.j2
dest: /etc/yum.repos.d/epel-testing.repo
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"
when:
- epel_specify_mirror
- ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"
- name: Configure Repository Settings (EL8)
template:
@@ -31,4 +63,6 @@
dest: /etc/yum.repos.d/epel-testing.repo
- src: el8-epel-testing-modular.repo.j2
dest: /etc/yum.repos.d/epel-testing-modular.repo
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "8"
when:
- epel_specify_mirror
- ansible_os_family == "RedHat" and ansible_distribution_major_version == "8"