]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
mgr: refact 'wait for all mgr to be up' task
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 6 Aug 2019 09:11:15 +0000 (11:11 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 7 Aug 2019 08:33:54 +0000 (10:33 +0200)
There's no need to use `shell` module here.
Instead of using `| python -c`, let's use `from_json` filter.

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

index 332a9002b37555e6268136938ffee1e9bc4ffec8..fdfbe20de3135c6e2f8a5f1f062c3b4d896f5d9c 100644 (file)
@@ -5,14 +5,14 @@
   when: dashboard_enabled | bool
 
 - name: wait for all mgr to be up
-  shell: "{{ container_exec_cmd_mgr | default('') }} ceph --cluster {{ cluster }} mgr dump -f json | python -c 'import sys, json; print(json.load(sys.stdin)[\"available\"])'"
+  command: "{{ container_exec_cmd_mgr | default('') }} ceph --cluster {{ cluster }} mgr dump -f json"
   register: mgr_dump
   retries: 30
   delay: 5
   delegate_to: "{{ groups[mon_group_name][0] }}"
   until:
     - mgr_dump.rc == 0
-    - mgr_dump.stdout | bool
+    - (mgr_dump.stdout | from_json).available | bool
 
 - name: get enabled modules from ceph-mgr
   command: "{{ container_exec_cmd_mgr | default('') }} ceph --cluster {{ cluster }} --format json mgr module ls"