Split the apt cache update when repos change from the install task

When the repositories change, the apt cache needs updating to bring
in the new indexes. Recently this has failed quite often. In the
hope that we can get more diagnostic information, and in order to
make the tasks a litte easier to read, we split them into two.

Change-Id: I4b1bb0d3c318a1f07b4a1d055faed65691565320
This commit is contained in:
Jesse Pretorius 2018-04-27 10:49:12 +01:00
parent 7daa94e69b
commit d99a5aee23

View File

@ -84,12 +84,22 @@
backup: yes
changed_when: false
- name: Update Apt cache
apt:
update_cache: yes
when:
- add_galera_repo | changed or add_percona_repo | changed
register: update_apt_cache
until: update_apt_cache | success
retries: 5
delay: 2
- name: Install galera_server role remote packages (apt)
apt:
name: "{{ galera_packages_list }}"
state: "{{ galera_server_package_state }}"
update_cache: yes
cache_valid_time: "{{ (add_galera_repo | changed or add_percona_repo | changed) | ternary('0', cache_timeout) }}"
cache_valid_time: "{{ cache_timeout }}"
register: install_remote_apt_packages
until: install_remote_apt_packages|success
retries: 5