]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
docker-common: fix ceph_health check
authorGuillaume Abrioux <gabrioux@redhat.com>
Mon, 18 Sep 2017 17:04:05 +0000 (19:04 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Thu, 21 Sep 2017 07:56:37 +0000 (09:56 +0200)
`docker ps` will always return `0`
(see: https://github.com/docker/cli/issues/538).

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

index bd37f414d2d3b3714ae82138e1b997bb5f1680d5..f96d90635d351846b85a151b5fd0f2d90b7dc94e 100644 (file)
@@ -9,4 +9,6 @@
     - "{{ ceph_config_keys }}"
     - "{{ statconfig.results }}"
   when:
+    - inventory_hostname == groups.get(mon_group_name)
     - item.1.stat.exists == true
+    - ceph_health.stdout_lines | length == 0
index f70c8e752d4fdcb907cacaf2777e675fc080b342..34a35acfe150d70fbc5a043c6e05a411269b5c4c 100644 (file)
   set_fact:
     docker_version: "{{ docker_version.stdout.split(' ')[2] }}"
 
-- name: check if a cluster is already running
-  command: "docker ps -q -a --filter='ancestor={{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'"
-  register: ceph_health
-  changed_when: false
-  failed_when: false
-  always_run: true
-
 # Only include 'checks.yml' when :
 # we are deploying containers without kv AND host is either a mon OR a nfs OR an osd,
 # AND
 # a cluster is not already running,
 # AND
 # we are not playing rolling-update.yml playbook.
+- name: check if a cluster is already running
+  command: "docker ps -q --filter=\'name=ceph-mon-{{ ansible_hostname }}\'"
+  register: ceph_health
+  changed_when: false
+  failed_when: false
+  always_run: true
+
 - name: include checks.yml
   include: checks.yml
   when:
@@ -60,8 +60,8 @@
        ((inventory_hostname in groups.get(mon_group_name, [])) or
         (inventory_hostname in groups.get(nfs_group_name, [])) or
         (inventory_hostname in groups.get(osd_group_name, []))))
-    - ceph_health.rc != 0
-    - not "{{ rolling_update | default(false) }}"
+    - ceph_health.stdout_lines | length == 0
+    - not rolling_update | default(false)
 
 - name: include misc/ntp_atomic.yml
   include: misc/ntp_atomic.yml