From 4f6c0f1053ce639eb07dbd3cb980e8db43fabd21 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 15 Mar 2018 11:17:29 +0000 Subject: [PATCH] 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 --- tasks/galera_install_apt.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tasks/galera_install_apt.yml b/tasks/galera_install_apt.yml index d09ffb0d..58ebf0f8 100644 --- a/tasks/galera_install_apt.yml +++ b/tasks/galera_install_apt.yml @@ -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