From 53f6d45981ca5f562467cf0ce8dc4c2ffcd48c98 Mon Sep 17 00:00:00 2001 From: Waldemar Smirnow Date: Thu, 19 Dec 2024 12:36:27 +0100 Subject: [PATCH] Fixed apt cache update Apt cache update was triggered by a notify. A notify handler is running at the end of the Ansible block. As this role is used as dependency for other roles (like opencast_opensearch), the trigger will run to late. --- handlers/main.yml | 4 ---- tasks/debian.yml | 14 +++++++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) delete mode 100644 handlers/main.yml diff --git a/handlers/main.yml b/handlers/main.yml deleted file mode 100644 index 2b3020c..0000000 --- a/handlers/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- name: Update apt cache - ansible.builtin.apt: - update_cache: true diff --git a/tasks/debian.yml b/tasks/debian.yml index 689d766..3dfbce5 100644 --- a/tasks/debian.yml +++ b/tasks/debian.yml @@ -12,7 +12,7 @@ state: present - name: Remove orphan opencast package repository definition - notify: Update apt cache + register: rm_orphan_repo ansible.builtin.apt_repository: repo: >- deb https://pkg.opencast.org/debian @@ -22,7 +22,7 @@ state: absent - name: Install the opencast package repository - notify: Update apt cache + register: add_oc_repo ansible.builtin.apt_repository: repo: >- deb https://pkg.opencast.org/debian @@ -33,7 +33,7 @@ state: "{{ 'present' if opencast_repository_enabled_release | bool else 'absent' }}" - name: Install the opencast testing package repository - notify: Update apt cache + register: add_oc_testing_repo ansible.builtin.apt_repository: repo: >- deb https://pkg.opencast.org/debian @@ -42,3 +42,11 @@ filename: opencast # yamllint disable-line rule:line-length state: "{{ 'present' if opencast_repository_enabled_testing | bool else 'absent' }}" + +- name: Update apt cache + ansible.builtin.apt: + update_cache: true + when: > + rm_orphan_repo is changed or + add_oc_repo is changed or + add_oc_testing_repo is changed