]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
purge-docker: added conditionals needed to successfully re-run purge
authorRandy J. Martinez <ramartin@redhat.com>
Wed, 28 Mar 2018 23:46:54 +0000 (18:46 -0500)
committerSébastien Han <seb@redhat.com>
Fri, 29 Jun 2018 11:43:12 +0000 (13:43 +0200)
Added 'ignore_errors: true' to multiple lines which run docker commands; even in cases where docker is no longer installed. Because of this, certain tasks in the purge-docker-cluster.yml will cause the playbook to fail if re-run and stop the purge. This leaves behind a dirty environment, and a playbook which can no longer be run.
Fix Regex line 275: Sometimes 'list-units' will output 4 spaces between loaded+active. The update will account for both scenarios.
purge fetch_directory: in other roles fetch_directory is hard linked ex.: "{{ fetch_directory }}"/"{{ somedir }}". That being said, fetch_directory will never have a trailing slash in the all.yml so this task was never being run(causing failures when trying to re-deploy).

Signed-off-by: Randy J. Martinez <ramartin@redhat.com>
(cherry picked from commit d1f2d64b15479524d9e347303c8d5e4bfe7c15d8)
Signed-off-by: Sébastien Han <seb@redhat.com>
infrastructure-playbooks/purge-docker-cluster.yml

index 3acd4589a1336d7ba2e08049ce1a807f3e1fc276..85c039924c3cdc4aa3d3c65a058c546a6bb9ed97 100644 (file)
@@ -48,7 +48,6 @@
       ceph_docker_registry: "docker.io"
     when: ceph_docker_registry is not defined
 
-
 - name: purge ceph mds cluster
 
   hosts:
@@ -86,6 +85,7 @@
       force: yes
     tags:
       remove_img
+    ignore_errors: true
 
 - name: purge ceph mgr cluster
 
       force: yes
     tags:
       remove_img
+    ignore_errors: true
 
 - name: purge ceph rgw cluster
 
       force: yes
     tags:
       remove_img
+    ignore_errors: true
 
 
 - name: purge ceph rbd-mirror cluster
 
   - name: get all the running osds
     shell: |
-      systemctl list-units | grep "loaded active" | grep -oE "ceph-osd@([0-9]{1,2}|[a-z]+).service"
+      systemctl list-units | grep 'loaded[[:space:]]\+active' | grep -oE "ceph-osd@([0-9]{1,2}|[a-z]+).service"
     register: osd_units
+    ignore_errors: true
 
   - name: disable ceph osd service
     service:
   - name: get prepare container
     command: "docker ps -a -q --filter='name=ceph-osd-prepare'"
     register: prepare_containers
+    ignore_errors: true
 
   - name: remove ceph osd prepare container
     command: "docker rm -f {{ item }}"
     with_items: "{{ prepare_containers.stdout_lines }}"
+    ignore_errors: true
 
   # NOTE(leseb): hope someone will find a more elegant way one day...
   - name: see if encrypted partitions are present
       force: yes
     tags:
       remove_img
+    ignore_errors: true
 
   - name: include vars from group_vars/osds.yml
     include_vars:
       force: yes
     tags:
       remove_img
+    ignore_errors: true
 
 
 - name: remove installed packages
       state: stopped
       enabled: no
     when: not is_atomic
+    ignore_errors: true
 
   - name: remove docker-py on Debian
     pip:
 
   - name: purge fetch directory for localhost
     file:
-      path: "{{ fetch_directory }}"
+      path: "{{ fetch_directory }}/"
       state: absent