Add retries to apt cache update

Updating the apt cache sometimes fails due to it being
an operation that uses mirrors on the internet. The
task should be retried to reduce the chance of a
transient failure causing the playbook to fail.

Change-Id: Ie23891b3fd8d8503044769a51b9b3fc5caf02eba
Partial-Bug: #1750656
This commit is contained in:
Jesse Pretorius 2018-03-15 11:17:29 +00:00
parent 684601b9af
commit 4f6c0f1053
1 changed files with 8 additions and 0 deletions

View File

@ -27,6 +27,10 @@
apt:
update_cache: yes
when: "ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}"
register: update_apt_cache
until: update_apt_cache | success
retries: 5
delay: 2
tags:
- galera-apt-packages
@ -120,6 +124,10 @@
when: >
"ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}" or
add_galera_repo | changed or add_percona_repo | changed
register: update_apt_cache
until: update_apt_cache | success
retries: 5
delay: 2
tags:
- galera-apt-packages