From: Michael Vollman Date: Thu, 17 May 2018 19:17:29 +0000 (-0400) Subject: Do nothing when mgr module is in good state X-Git-Tag: v3.1.0rc4~19 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e1aa85f04cd97fa18452b01c806ddca2ec7fa173;p=ceph-ansible.git Do nothing when mgr module is in good state Check whether a mgr module is supposed to be disabled before disabling it and whether it is already enabled before enabling it. Signed-off-by: Michael Vollman (cherry picked from commit ed050bf3f682e74d9453451276d10af8c6b5947f) Signed-off-by: Sébastien Han --- diff --git a/roles/ceph-mgr/tasks/main.yml b/roles/ceph-mgr/tasks/main.yml index a26f8c09f..db9caad32 100644 --- a/roles/ceph-mgr/tasks/main.yml +++ b/roles/ceph-mgr/tasks/main.yml @@ -23,19 +23,25 @@ when: - ceph_release_num[ceph_release] >= ceph_release_num['luminous'] +- name: set _ceph_mgr_modules fact + set_fact: + _ceph_mgr_modules: "{{ enabled_ceph_mgr_modules.get('stdout', '{}') | from_json }}" + - name: disable ceph mgr enabled modules command: "{{ docker_exec_cmd_mgr | default('') }} ceph --cluster {{ cluster }} mgr module disable {{ item }}" # When ceph release is jewel, ceph-mgr role is skipped. It means, the enabled_ceph_mgr_modules doesn't contain 'stdout' attribute. # Therefore, we need to get a default value which can be used up by from_json filter. - with_items: "{{ enabled_ceph_mgr_modules.get('stdout', '{}') | from_json }}" + with_items: "{{ _ceph_mgr_modules.enabled_modules }}" delegate_to: "{{ groups[mon_group_name][0] }}" when: + - item not in ceph_mgr_modules - not enabled_ceph_mgr_modules.get('skipped') - ceph_release_num[ceph_release] >= ceph_release_num['luminous'] - name: add modules to ceph-mgr - command: "{{ docker_exec_cmd_mgr | default('') }} ceph --cluster {{ cluster }} mgr module enable {{ item }} --force" + command: "{{ docker_exec_cmd_mgr | default('') }} ceph --cluster {{ cluster }} mgr module enable {{ item }}" with_items: "{{ ceph_mgr_modules }}" delegate_to: "{{ groups[mon_group_name][0] }}" when: + - item in _ceph_mgr_modules.disabled_modules - ceph_release_num[ceph_release] >= ceph_release_num['luminous']