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 puts responsibility for updating the cache on the apt module task, this means updating the cache will get retried on failure and no longer fail silently. The changes made include: - the two apt_repository tasks have their update_cache parameter set to no so it is clear where any update happens and there is no unnecessary duplication of cache updates. - the use of retries is removed given the tasks no longer need to make use of the network. - the apt_repository task result variables have been given unique names to ensure that the cache is updated if only the galera repository is added. Change-Id: I91b7929113f720bc3c55343c481096657376302f Partial-bug: 1750656
This commit is contained in:
parent
486e565172
commit
7596eaa889
|
@ -56,20 +56,16 @@
|
|||
repo: "{{ galera_repo.repo }}"
|
||||
filename: "{{ galera_repo.filename | default(omit) }}"
|
||||
state: "{{ galera_repo.state }}"
|
||||
register: add_repos
|
||||
until: add_repos|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
update_cache: "no"
|
||||
register: add_galera_repo
|
||||
|
||||
- name: Add percona repo
|
||||
apt_repository:
|
||||
repo: "{{ galera_percona_xtrabackup_repo.repo }}"
|
||||
filename: "{{ galera_percona_xtrabackup_repo.filename | default(omit) }}"
|
||||
state: "{{ (use_percona_upstream | bool) | ternary('present','absent') }}"
|
||||
register: add_repos
|
||||
until: add_repos|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
update_cache: "no"
|
||||
register: add_percona_repo
|
||||
|
||||
- name: Preseed galera password(s)
|
||||
debconf:
|
||||
|
@ -92,7 +88,11 @@
|
|||
name: "{{ galera_install_packages_list | selectattr('enabled') | rejectattr('local_pkg') | sum(attribute='packages', start=[]) }}"
|
||||
state: "{{ galera_server_package_state }}"
|
||||
update_cache: yes
|
||||
cache_valid_time: "{{ (add_repos | changed) | ternary('0', cache_timeout) }}"
|
||||
cache_valid_time: "{{ (add_galera_repo | changed or add_percona_repo | changed) | ternary('0', cache_timeout) }}"
|
||||
register: install_remote_apt_packages
|
||||
until: install_remote_apt_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
|
||||
- name: Install galera_server role local packages (apt)
|
||||
apt:
|
||||
|
|
Loading…
Reference in New Issue