From 53cdddf88699263763b36643565e5f846d9d13a8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Han?= Date: Tue, 30 Oct 2018 15:53:07 +0100 Subject: [PATCH] ceph-common: use a handler MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We need a handler because the task changed, the old implementation was basically mimicing a handler. Signed-off-by: Sébastien Han --- roles/ceph-common/handlers/main.yml | 8 ++++++++ .../tasks/installs/debian_community_repository.yml | 2 +- .../tasks/installs/debian_custom_repository.yml | 3 ++- .../tasks/installs/debian_dev_repository.yml | 2 +- .../tasks/installs/debian_uca_repository.yml | 3 ++- .../ceph-common/tasks/installs/install_on_debian.yml | 11 ----------- .../installs/prerequisite_rhcs_cdn_install_debian.yml | 2 +- .../installs/prerequisite_rhcs_iso_install_debian.yml | 2 +- 8 files changed, 16 insertions(+), 17 deletions(-) create mode 100644 roles/ceph-common/handlers/main.yml 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 -- 2.39.5