diff --git a/tasks/centos/main.yml b/tasks/centos/main.yml
index 1195a8b3d1d76da455f32b3df20827c38290d682..992b2e8b94c06a1a0fa9538ec7b09dd2d2afd952 100644
--- a/tasks/centos/main.yml
+++ b/tasks/centos/main.yml
@@ -1,15 +1,20 @@
 ---
 
 - name: Enable EPEL repo with standard package
-  dnf:
+  ansible.builtin.dnf:
     name: epel-release
     state: present
     update_cache: yes
   when: apply_epel is defined and apply_epel and (ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux')
 
-- name: Enable EPEL repo with external package
-  dnf:
-    name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
-    state: present
-    update_cache: yes
+- block:
+    - name: Enable EPEL GPG key for externel repo
+      ansible.builtin.rpm_key:
+        state: present
+        key: "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}"
+    - name: Enable EPEL repo with external package
+      ansible.builtin.dnf:
+        name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
+        state: present
+        update_cache: yes
   when: apply_epel is defined and apply_epel and ansible_distribution == 'OracleLinux'