]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
shrink-mon: refact 'verify the monitor is out of the cluster' task
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 14 Aug 2019 09:04:30 +0000 (11:04 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 14 Aug 2019 14:42:02 +0000 (16:42 +0200)
use `from_json` filter instead of a `| python` so we can get rid of the
`shell` module usage here.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
infrastructure-playbooks/shrink-mon.yml

index c5759a2807b6ccc109a431a9b0e24e9917373c62..1acc5a91825cd9d23e78435b3e7d004f47037549 100644 (file)
       delegate_to: "{{ mon_host }}"
 
   post_tasks:
-    # NOTE (leseb): sorry for the 'sleep' command
-    # but it will take a couple of seconds for other monitors
-    # to notice that one member has left.
-    # 'sleep 5' is not that bad and should be sufficient
     - name: verify the monitor is out of the cluster
-      shell: |
-        {{ container_exec_cmd }} ceph --cluster {{ cluster }} -s -f json | {{ discovered_interpreter_python }} -c 'import sys, json; print(json.load(sys.stdin)["quorum_names"])'
+      command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} -s -f json"
       delegate_to: "{{ mon_host }}"
       failed_when: false
       register: result
-      until: mon_to_kill_hostname not in result.stdout
+      until: mon_to_kill_hostname not in (result.stdout | from_json)['quorum_names']
       retries: 2
       delay: 10