]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
rolling_update: use ceph health instead of ceph -s
authorDimitri Savineau <dsavinea@redhat.com>
Mon, 26 Oct 2020 23:35:06 +0000 (19:35 -0400)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 3 Nov 2020 13:32:09 +0000 (14:32 +0100)
The ceph status command returns a lot of information stored in variables
and/or facts which could consume resources for nothing.
When checking the cluster health, we're using the health structure in the
ceph status output.
To optimize this, we could use the ceph health command which contains
the same needed information.

$ ceph status -f json | wc -c
2001
$ ceph health -f json | wc -c
46

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit acddf4fb679f5f5251b3414793680042ee3be394)

infrastructure-playbooks/rolling_update.yml

index 61f09adcab0a1dd101a49d59f97cf2a8364df078..c338c13cf9511bc963037f31049a656b6b6b5bcd 100644 (file)
 
     - block:
         - name: get ceph cluster status
-          command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} -s -f json"
-          register: check_cluster_status
+          command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} health -f json"
+          register: check_cluster_health
           delegate_to: "{{ mon_host }}"
 
         - block:
             - name: fail if cluster isn't in an acceptable state
               fail:
                 msg: "cluster is not in an acceptable state!"
-          when: (check_cluster_status.stdout | from_json).health.status == 'HEALTH_ERR'
+          when: (check_cluster_health.stdout | from_json).status == 'HEALTH_ERR'
       when: inventory_hostname == groups[mon_group_name] | first
 
     - name: ensure /var/lib/ceph/bootstrap-rbd-mirror is present