Fix cache update after initial apt_repository fail

If apt_repository fails to update the apt cache after updating the
configuration, retries don't register there was a change and so no
attempt is made to update the cache by the module on the second attempt.
This failure can result in a failure to install packages.

This change adds an apt module task to update the cache if the
apt_repository task registers a change. This means updating the cache
will get retried on failure and no longer fail silently.

Change-Id: I41de2b9a98977bb89de812a9fbc85a9f99d62942
Partial-bug: 1750656
(cherry picked from commit 69729be3d1)
This commit is contained in:
git-harry 2018-02-21 10:35:06 +00:00
parent 35cd41424d
commit 3a01c65e3d
1 changed files with 10 additions and 2 deletions

View File

@ -87,9 +87,17 @@
repo: "{{ galera_client_repo }}"
filename: "{{ mariadb_repo_filename }}"
state: present
update_cache: yes
update_cache: no
register: add_repo
until: add_repo | success
tags:
- galera-client-repos
- name: Update Apt cache
apt:
update_cache: yes
when: add_repo | changed
register: update_apt_cache
until: update_apt_cache | success
retries: 5
delay: 2
tags: