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: I60d17d3cae97aed3d9bfd26652ef6306a678399c
Partial-Bug: #1750656
This commit is contained in:
Jesse Pretorius 2018-03-15 11:22:12 +00:00
parent b04b48bc7f
commit 2ca6683653
1 changed files with 4 additions and 0 deletions

View File

@ -25,6 +25,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
- name: Install apt packages
apt: