network/tests/tasks/enable_epel.yml
Wen Liang 5ff1189409 ansible-lint: Fix name[missing] and name[play] failures
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2023-04-10 17:49:07 +02:00

46 lines
1.6 KiB
YAML

# SPDX-License-Identifier: BSD-3-Clause
---
- name: Create EPEL yum repo and Enable EPEL
when:
- ansible_distribution in ['RedHat', 'CentOS']
- ansible_distribution_major_version in ['7', '8']
block:
- name: Create EPEL {{ ansible_distribution_major_version }}
command:
cmd: >-
rpm -iv https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{
ansible_distribution_major_version }}.noarch.rpm
# noqa command-instead-of-module
creates: /etc/yum.repos.d/epel.repo
register: __epel_status
# sometimes the rpm download returns a 403 - I think it is when too
# many parallel jobs attempt the download from the same controller in
# too short a period of time, so the epel server throttles additional
# downloads - use a retry here to mitigate
until: __epel_status is success
retries: 6
delay: 10
- name: Enable EPEL 7
command: yum-config-manager --enable epel
when: ansible_distribution_major_version == '7'
changed_when: false
- name: Enable EPEL 8
command: dnf config-manager --set-enabled epel
when: ansible_distribution_major_version == '8'
changed_when: false
- name: Enable EPEL 6
copy:
dest: /etc/yum.repos.d/epel.repo
content: |
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=https://archives.fedoraproject.org/pub/archive/epel/6/$basearch
enabled=1
gpgcheck=0
mode: "0644"
when:
- ansible_distribution in ['RedHat', 'CentOS']
- ansible_distribution_major_version == '6'