From d99a5aee238dcd8945b72a5b575fceea5d3b1937 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Fri, 27 Apr 2018 10:49:12 +0100 Subject: [PATCH] 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 --- tasks/galera_install_apt.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tasks/galera_install_apt.yml b/tasks/galera_install_apt.yml index 661830a7..4ff92b61 100644 --- a/tasks/galera_install_apt.yml +++ b/tasks/galera_install_apt.yml @@ -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