]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
mgr: fix broken task on jewel 2075/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 18 Oct 2017 09:43:40 +0000 (11:43 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 18 Oct 2017 12:11:46 +0000 (14:11 +0200)
3a58757 introduced an issue for Jewel deployments, since this role is
skipped, `enabled_ceph_mgr_modules.stdout` doesn't exist, therefore, it
ends up with an attribute error.

Uses `.get()` to retrieve `stdout` with a default value so it won't fail
if this attribute doesn't exist (jewel).

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
roles/ceph-mgr/tasks/main.yml

index fabef8e08e63a0ae8cdffec39459a41c85142641..f017f889218bb03ba7d84b2eb4761d1803049c76 100644 (file)
 
 - name: disable ceph mgr enabled modules
   command: "{{ docker_exec_cmd_mgr | default('') }} ceph --cluster {{ cluster }} mgr module disable {{ item }}"
-  with_items: "{{ enabled_ceph_mgr_modules.stdout | from_json }}"
+  # 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 }}"
   delegate_to: "{{ groups[mon_group_name][0] }}"
+  when:
+    - not enabled_ceph_mgr_modules.get('skipped')
 
 - name: add modules to ceph-mgr
   command: "{{ docker_exec_cmd_mgr | default('') }} ceph --cluster {{ cluster }} mgr module enable {{ item }}"