test: Retry until success when installing package

Sometimes the rpm download returns a 403, which is likely caused by
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.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
This commit is contained in:
Wen Liang 2024-01-31 14:39:49 -05:00 committed by Richard Megginson
parent 910ddd20a9
commit ae9f212086
8 changed files with 45 additions and 0 deletions

View file

@ -36,6 +36,9 @@
when:
- not network_packages is subset(ansible_facts.packages.keys())
register: __network_package_install
until: __network_package_install is success
retries: 6
delay: 10
- name: Install NetworkManager and nmstate when using network_state variable
package:

View file

@ -23,6 +23,11 @@
import_tasks: tasks/assert_device_present.yml
vars:
interface: "{{ dhcp_interface2 }}"
- name: "Backup the /etc/resolv.conf for initscript"
command: cp -vf /etc/resolv.conf /etc/resolv.conf.bak
when:
- network_provider == "initscripts"
changed_when: false
- name: Test bond device using deprecated 'master' argument
block:
- name: "TEST Add Bond with 2 ports using deprecated 'master' argument"
@ -113,3 +118,8 @@
changed_when: false
- name: Import the task 'remove_test_interfaces_with_dhcp.yml'
import_tasks: tasks/remove_test_interfaces_with_dhcp.yml
- name: "Restore the /etc/resolv.conf for initscript"
command: mv -vf /etc/resolv.conf.bak /etc/resolv.conf
when:
- network_provider == "initscripts"
changed_when: false

View file

@ -6,6 +6,14 @@
state: present
use: "{{ (__network_is_ostree | d(false)) |
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
register: __install_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: __install_status is success
retries: 6
delay: 10
- name: Install pgrep, sysctl
package:

View file

@ -19,6 +19,10 @@
state: present
use: "{{ (__network_is_ostree | d(false)) |
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
register: __install_status
until: __install_status is success
retries: 6
delay: 10
# veth
- name: Create veth interface {{ interface }}

View file

@ -19,6 +19,10 @@
state: present
use: "{{ (__network_is_ostree | d(false)) |
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
register: __install_status
until: __install_status is success
retries: 6
delay: 10
- name: Create directory for test certificates
file:

View file

@ -9,6 +9,10 @@
state: present
use: "{{ (__network_is_ostree | d(false)) |
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
register: __install_status
until: __install_status is success
retries: 6
delay: 10
- name: Ensure NetworkManager is running
service:

View file

@ -8,6 +8,10 @@
state: present
use: "{{ (__network_is_ostree | d(false)) |
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
register: __install_status
until: __install_status is success
retries: 6
delay: 10
- name: Check if can test on CentOS and setup if possible
when: ansible_distribution == 'CentOS'

View file

@ -8,6 +8,10 @@
state: present
use: "{{ (__network_is_ostree | d(false)) |
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
register: __install_status
until: __install_status is success
retries: 6
delay: 10
- name: Configure CentOS system for testing, if possible
when: ansible_distribution == 'CentOS'
@ -42,6 +46,10 @@
state: present
when:
- ansible_distribution == 'Fedora'
register: __install_status
until: __install_status is success
retries: 6
delay: 10
# Since DNF package manager can not warrant installing the kernel module with
# the same version as the kernel in target machine, install the kernel module