From 93e0a4a8f5f34c248d3467f3d1c8300ced0f5148 Mon Sep 17 00:00:00 2001 From: David Galloway Date: Fri, 15 Nov 2019 10:43:47 -0500 Subject: [PATCH] common: Update yum metadata from upstream epel and exclude mirrors Signed-off-by: David Galloway --- roles/common/tasks/epel.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/roles/common/tasks/epel.yml b/roles/common/tasks/epel.yml index f3befb8..a75c97c 100644 --- a/roles/common/tasks/epel.yml +++ b/roles/common/tasks/epel.yml @@ -27,6 +27,21 @@ - epel-mirrorlist - epel-testing-mirrorlist -- name: Clean yum cache - shell: yum clean all - when: epel_repo is defined and epel_repo is changed +# A few times a year, we'd see a bunch of 404 errors during yum transactions that involved epel mirrors. +# It has to do with upstream EPEL being updated and mirrors lagging behind. +- name: Temporarily comment mirrorlist so we can update yum cache + replace: + path: "/etc/yum.repos.d/{{ item.key }}.repo" + regexp: '^(.*mirror.*)' + replace: '#\1' + with_dict: "{{ epel_repos }}" + +- name: Update yum cache + shell: yum clean all; yum makecache + +- name: Uncomment mirrorlist + replace: + path: "/etc/yum.repos.d/{{ item.key }}.repo" + regexp: '^#(.*mirror.*)' + replace: '\1' + with_dict: "{{ epel_repos }}" -- 2.39.5