---
- name: Check if EPEL is installed
  stat:
    path: /etc/yum.repos.d/epel.repo
  register: epel_installed
  when: ansible_os_family == "RedHat"

- name: Install EPEL repo
  become: yes
  yum:
    name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
    state: present
  when: ansible_os_family == "RedHat" and not epel_installed.stat.exists

---
- name: Check if EPEL is installed
  stat:
    path: /etc/yum.repos.d/epel.repo
  register: epel_installed
  when: ansible_os_family == "RedHat"
  tags: epel

- name: Install EPEL repo
  become: yes
  yum:
    name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
    state: present
  when: ansible_os_family == "RedHat" and not epel_installed.stat.exists
  tags: epel

Add tags for EPEL role
Add tags for EPEL role
