From 54f74e29a97c79e283dcbedf65f94b271fb15417 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Mon, 5 Nov 2018 12:08:06 +0000 Subject: [PATCH] tests: Skip role if ceph_mons list is empty The role execution only makes sense if we are configuring a node as a Ceph monitor so we can skip all the task inclusions if this list is empty. Change-Id: I8155bf199a99912527a50b98dfe916b8b2d9b23e --- tasks/main.yml | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 33b3d05..6ff4b15 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -13,6 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +- name: End playbook if disabled + meta: end_play + when: + - ceph_mons | list | length == 0 + tags: + - always + - name: Gather variables for each operating system include_vars: "{{ item }}" with_first_found: @@ -26,45 +33,30 @@ - include_tasks: "ceph_preinstall_{{ ansible_pkg_mgr }}.yml" when: - - ceph_mons != [] - - ceph_mons | list == ceph_mons - ceph_pkg_source != 'distro' tags: - ceph-install - include_tasks: ceph_install.yml - when: - - ceph_mons != [] - - ceph_mons | list == ceph_mons tags: - ceph-install - include_tasks: ceph_install_python_libs.yml when: - - ceph_mons != [] - - ceph_mons | list == ceph_mons - openstack_service_venv_bin != '' tags: - ceph-install - include_tasks: ceph_get_mon_host.yml - when: - - ceph_mons != [] - - ceph_mons | list == ceph_mons tags: - ceph-config - include_tasks: ceph_config.yml - when: - - ceph_mons != [] - - ceph_mons | list == ceph_mons tags: - ceph-config - include_tasks: ceph_auth.yml when: - cephx | bool - - ceph_mons != [] - - ceph_mons | list == ceph_mons tags: - ceph-config