]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
purge-docker-cluste: add a task to check hosts
authorSébastien Han <seb@redhat.com>
Mon, 3 Dec 2018 15:46:38 +0000 (16:46 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 11 Dec 2018 08:59:25 +0000 (09:59 +0100)
It's useful when running on CI to see what might remain on the machines.
So we list all the containers and images. We expect the list to be
empty.

We fail if we see containers running.

Signed-off-by: Sébastien Han <seb@redhat.com>
infrastructure-playbooks/purge-docker-cluster.yml

index 16d886687bf936e1b3e3275aeb3752be8874aed1..000b5e5053565085488b0f8b14d47fa069b16158 100644 (file)
       path: /etc/profile.d/ceph-aliases.sh
       state: absent
 
+- name: check container hosts
+
+  hosts:
+    - "{{ mon_group_name|default('mons') }}"
+    - "{{ osd_group_name|default('osds') }}"
+    - "{{ mds_group_name|default('mdss') }}"
+    - "{{ rgw_group_name|default('rgws') }}"
+    - "{{ rbdmirror_group_name|default('rbdmirrors') }}"
+    - "{{ nfs_group_name|default('nfss') }}"
+    - "{{ mgr_group_name|default('mgrs') }}"
+
+  become: true
+
+  tasks:
+
+  - import_role:
+      name: ceph-defaults
+      private: false
+
+  - name: show container list on all the nodes (should be empty)
+    command: >
+      {{ container_binary }} ps --filter='name=ceph' -a -q
+    register: containers_list
+    changed_when: false
+
+  - name: show container images on all the nodes (should be empty if tags was passed remove_img)
+    command: >
+      {{ container_binary }} images
+    register: images_list
+    changed_when: false
+
+  - name: fail if container are still present
+    fail:
+      msg: "It looks like container are still present."
+    when: containers_list.stdout_lines|length > 0
+
 - name: remove installed packages
 
   hosts:
   - name: remove data
     shell: rm -rf /var/lib/ceph/*
 
-
 - name: purge fetch directory
 
   hosts: