diff --git a/roles/ceph-common/handlers/main.yml b/roles/ceph-common/handlers/main.yml new file mode 100644 index 000000000..9bcab1bfc --- /dev/null +++ b/roles/ceph-common/handlers/main.yml @@ -0,0 +1,8 @@ +--- +- name: update apt cache if a repo was added + apt: + update_cache: yes + register: update_apt_cache + retries: 5 + delay: 2 + until: update_apt_cache | success \ No newline at end of file diff --git a/roles/ceph-common/tasks/installs/debian_community_repository.yml b/roles/ceph-common/tasks/installs/debian_community_repository.yml index 6b41290c6..3471f0184 100644 --- a/roles/ceph-common/tasks/installs/debian_community_repository.yml +++ b/roles/ceph-common/tasks/installs/debian_community_repository.yml @@ -9,4 +9,4 @@ repo: "deb {{ ceph_stable_repo }} {{ ceph_stable_distro_source | default(ansible_lsb.codename) }} main" state: present update_cache: no - register: add_debian_apt_repo + notify: update apt cache if a repo was added diff --git a/roles/ceph-common/tasks/installs/debian_custom_repository.yml b/roles/ceph-common/tasks/installs/debian_custom_repository.yml index 2ba350447..d544be19c 100644 --- a/roles/ceph-common/tasks/installs/debian_custom_repository.yml +++ b/roles/ceph-common/tasks/installs/debian_custom_repository.yml @@ -4,4 +4,5 @@ repo: "deb {{ ceph_custom_repo }} {{ ansible_lsb.codename }} main" state: present update_cache: no - register: add_debian_apt_repo + notify: update apt cache if a repo was added + diff --git a/roles/ceph-common/tasks/installs/debian_dev_repository.yml b/roles/ceph-common/tasks/installs/debian_dev_repository.yml index 3aab4a03d..e0d3195cb 100644 --- a/roles/ceph-common/tasks/installs/debian_dev_repository.yml +++ b/roles/ceph-common/tasks/installs/debian_dev_repository.yml @@ -10,4 +10,4 @@ repo: "{{ ceph_dev_deb_repo.content }}" state: present update_cache: no - register: add_debian_apt_repo + notify: update apt cache if a repo was added diff --git a/roles/ceph-common/tasks/installs/debian_uca_repository.yml b/roles/ceph-common/tasks/installs/debian_uca_repository.yml index 5fb970a0b..2629b47e3 100644 --- a/roles/ceph-common/tasks/installs/debian_uca_repository.yml +++ b/roles/ceph-common/tasks/installs/debian_uca_repository.yml @@ -8,4 +8,5 @@ repo: "deb {{ ceph_stable_repo_uca }} {{ ceph_stable_release_uca }} main" state: present update_cache: no - register: add_debian_apt_repo + notify: update apt cache if a repo was added + diff --git a/roles/ceph-common/tasks/installs/install_on_debian.yml b/roles/ceph-common/tasks/installs/install_on_debian.yml index 9b8471ba1..30b70a97b 100644 --- a/roles/ceph-common/tasks/installs/install_on_debian.yml +++ b/roles/ceph-common/tasks/installs/install_on_debian.yml @@ -4,17 +4,6 @@ when: - ceph_origin == 'repository' -- name: update apt cache if a repo was added - apt: - update_cache: yes - register: update_apt_cache - retries: 5 - delay: 2 - until: update_apt_cache | success - when: - - add_debian_apt_repo is defined - - add_debian_apt_repo.changed | default(false) - - name: update apt cache if cache_valid_time has expired apt: update_cache: yes diff --git a/roles/ceph-common/tasks/installs/prerequisite_rhcs_cdn_install_debian.yml b/roles/ceph-common/tasks/installs/prerequisite_rhcs_cdn_install_debian.yml index c8f00f806..5a43e92a0 100644 --- a/roles/ceph-common/tasks/installs/prerequisite_rhcs_cdn_install_debian.yml +++ b/roles/ceph-common/tasks/installs/prerequisite_rhcs_cdn_install_debian.yml @@ -9,9 +9,9 @@ repo: "deb {{ ceph_rhcs_cdn_debian_repo }}{{ ceph_rhcs_cdn_debian_repo_version }}/{{ item.repo }} {{ ceph_stable_distro_source | default(ansible_lsb.codename) }} main" state: present update_cache: no - register: add_debian_apt_repo with_items: - { repo: "MON", configure: (mon_group_name in group_names or mgr_group_name in group_names) } - { repo: "OSD", configure: (osd_group_name in group_names) } - { repo: "Tools", configure: (rgw_group_name in group_names or mds_group_name in group_names or nfs_group_name in group_names or iscsi_gw_group_name in group_names or client_group_name in group_names) } when: item.configure + notify: update apt cache if a repo was added diff --git a/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install_debian.yml b/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install_debian.yml index 68743ad9e..7671e09f6 100644 --- a/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install_debian.yml +++ b/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install_debian.yml @@ -53,8 +53,8 @@ repo: "deb file://{{ ceph_rhcs_repository_path }}/{{ item }} {{ ansible_lsb.codename }} main" state: present update_cache: no - register: add_debian_apt_repo with_items: - MON - OSD - Tools + notify: update apt cache if a repo was added