From ee42e0a79b24f55b472e63e3300fc23e3ecd1ea0 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Fri, 23 Oct 2026 12:18:07 +0300 Subject: [PATCH] Retry all RPM package installations on mirror errors Only "Install RPM package" used the shared retry policy of the playbook, so mirror hiccups still failed the provisioning, e.g. "Update all packages" with "Failed to download metadata for repo 'epel': Cannot download repomd.xml: ... All mirrors were tried" (ALBS build 94195). Opt in the rest of the tasks that install or update RPM packages: in the provisioning epel-release, the update of all packages, the additional packages and ansible, and enabling the module of the tested package. Uninstallation keeps its own retries. --- .../roles/install_uninstall/tasks/main.yml | 4 ++++ resources/roles/preparation/tasks/rhel.yml | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/resources/roles/install_uninstall/tasks/main.yml b/resources/roles/install_uninstall/tasks/main.yml index a4ff846..4e59597 100644 --- a/resources/roles/install_uninstall/tasks/main.yml +++ b/resources/roles/install_uninstall/tasks/main.yml @@ -8,6 +8,10 @@ - name: Enable module shell: dnf module enable -y "{{ module_name }}:{{ module_stream }}:{{ module_version }}" + register: pkg_mgr_result + until: pkg_mgr_retry_done | bool + retries: "{{ pkg_mgr_retries }}" + delay: "{{ pkg_mgr_retry_delay }}" when: > ansible_facts.os_family == 'RedHat' and module_name is defined and module_stream is defined and module_version is defined diff --git a/resources/roles/preparation/tasks/rhel.yml b/resources/roles/preparation/tasks/rhel.yml index 18b2c28..e134782 100644 --- a/resources/roles/preparation/tasks/rhel.yml +++ b/resources/roles/preparation/tasks/rhel.yml @@ -125,6 +125,10 @@ name: epel-release state: present lock_timeout: 300 + register: pkg_mgr_result + until: pkg_mgr_retry_done | bool + retries: "{{ pkg_mgr_retries }}" + delay: "{{ pkg_mgr_retry_delay }}" when: "ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_major_version | int >= 8" - name: Install epel-release (7 and less) @@ -132,6 +136,10 @@ name: "{{ epel_release_url }}" state: present lock_timeout: 300 + register: pkg_mgr_result + until: pkg_mgr_retry_done | bool + retries: "{{ pkg_mgr_retries }}" + delay: "{{ pkg_mgr_retry_delay }}" when: > epel_release_url is defined and epel_release_url and @@ -148,6 +156,10 @@ name: "*" state: latest lock_timeout: 300 + register: pkg_mgr_result + until: pkg_mgr_retry_done | bool + retries: "{{ pkg_mgr_retries }}" + delay: "{{ pkg_mgr_retry_delay }}" - name: Remove CentOS-Base.repo file again (just in case) file: @@ -163,6 +175,10 @@ state: present enablerepo: epel lock_timeout: 300 + register: pkg_mgr_result + until: pkg_mgr_retry_done | bool + retries: "{{ pkg_mgr_retries }}" + delay: "{{ pkg_mgr_retry_delay }}" when: centos_7_x32 | bool is false - name: Install additional packages on CentOS 7 i686 @@ -170,6 +186,10 @@ name: "{{ additional_packages }}" state: present lock_timeout: 300 + register: pkg_mgr_result + until: pkg_mgr_retry_done | bool + retries: "{{ pkg_mgr_retries }}" + delay: "{{ pkg_mgr_retry_delay }}" when: centos_7_x32 | bool - name: Install ansible @@ -178,6 +198,10 @@ state: present enablerepo: epel lock_timeout: 300 + register: pkg_mgr_result + until: pkg_mgr_retry_done | bool + retries: "{{ pkg_mgr_retries }}" + delay: "{{ pkg_mgr_retry_delay }}" when: pytest_is_needed | bool ignore_errors: "{{ ignore_ansible_install_errors | bool }}"