Files
ansible-role-repo-epel/tasks/main.yml
2021-05-06 09:46:31 +12:00

68 lines
1.8 KiB
YAML

---
# tasks file for repo-epel
- 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:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
- src: el7-epel.repo.j2
dest: /etc/yum.repos.d/epel.repo
- src: el7-epel-testing.repo.j2
dest: /etc/yum.repos.d/epel-testing.repo
when:
- epel_specify_mirror
- ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"
- name: Configure Repository Settings (EL8)
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
- src: el8-epel.repo.j2
dest: /etc/yum.repos.d/epel.repo
- src: el8-epel-modular.repo.j2
dest: /etc/yum.repos.d/epel-modular.repo
- src: el8-epel-playground.repo.j2
dest: /etc/yum.repos.d/epel-playground.repo
- src: el8-epel-testing.repo.j2
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:
- epel_specify_mirror
- ansible_os_family == "RedHat" and ansible_distribution_major_version == "8"