]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
purge-cluster: do not use ceph-detect-init
authorAndrew Schoen <aschoen@redhat.com>
Tue, 7 Feb 2017 17:57:38 +0000 (11:57 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Wed, 8 Feb 2017 12:24:44 +0000 (06:24 -0600)
We can not always ensure that ceph-detect-init will be
present on the system.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1418980

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
infrastructure-playbooks/purge-cluster.yml

index e63cf3ab229e7acf2e9735d2f253542b5691ffae..083fda9963e930e08d7f27d47a226a7783b2901f 100644 (file)
@@ -31,7 +31,7 @@
          invoking the playbook"
     when: ireallymeanit != 'yes'
 
-- name: gather facts and check init system
+- name: gather facts on all hosts
 
   vars:
     mon_group_name:       mons
@@ -54,9 +54,7 @@
   become: true
 
   tasks:
-  - name: detect init system
-    command: ceph-detect-init
-    register: init_system
+    - debug: msg="gather facts on all Ceph hosts for following reference"
 
 - name: purge ceph mds cluster
 
       name: ceph-mds@{{ ansible_hostname }}
       state: stopped
       enabled: no
-    when: init_system.stdout == 'systemd'
+    when: ansible_service_mgr == 'systemd'
 
   - name: stop ceph mdss
     shell: "service ceph status mds ; if [ $? == 0 ] ; then service ceph stop mds ; else echo ; fi"
-    when: init_system.stdout == 'sysvinit'
+    when: ansible_service_mgr == 'sysvinit'
 
   - name: stop ceph mdss on ubuntu
     command: initctl stop ceph-mds cluster={{ cluster }} id={{ ansible_hostname }}
     failed_when: false
-    when: init_system.stdout == 'upstart'
+    when: ansible_service_mgr == 'upstart'
 
 
 - name: purge ceph rgw cluster
       name: ceph-radosgw@rgw.{{ ansible_hostname }}
       state: stopped
       enabled: no
-    when: init_system.stdout == 'systemd'
+    when: ansible_service_mgr == 'systemd'
 
   - name: stop ceph rgws
     shell: "service ceph-radosgw status ; if [ $? == 0 ] ; then service ceph-radosgw stop ; else echo ; fi"
-    when: init_system.stdout == 'sysvinit'
+    when: ansible_service_mgr == 'sysvinit'
 
   - name: stop ceph rgws on ubuntu
     command: initctl stop radosgw cluster={{ cluster }} id={{ ansible_hostname }}
     failed_when: false
-    when: init_system.stdout == 'upstart'
+    when: ansible_service_mgr == 'upstart'
 
 
 - name: purge ceph rbd-mirror cluster
     service:
       name: ceph-rbd-mirror@admin.service
       state: stopped
-    when: init_system.stdout == 'systemd'
+    when: ansible_service_mgr == 'systemd'
 
   - name: stop ceph rbd mirror on ubuntu
     command: initctl stop ceph-rbd-mirror cluster={{ cluster }} id=admin
     failed_when: false
-    when: init_system.stdout == 'upstart'
+    when: ansible_service_mgr == 'upstart'
 
 
 - name: purge ceph nfs cluster
     service:
       name: nfs-ganesha
       state: stopped
-    when: init_system.stdout == 'systemd'
+    when: ansible_service_mgr == 'systemd'
 
   - name: stop ceph nfss
     shell: "service nfs-ganesha status ; if [ $? == 0 ] ; then service nfs-ganesha stop ; else echo ; fi"
-    when: init_system.stdout == 'sysvinit'
+    when: ansible_service_mgr == 'sysvinit'
 
   - name: stop ceph nfss on ubuntu
     command: initctl stop nfs-ganesha
     failed_when: false
-    when: init_system.stdout == 'upstart'
+    when: ansible_service_mgr == 'upstart'
 
 
 - name: purge ceph osd cluster
       state: stopped
       enabled: no
     with_items: "{{ osd_ids.stdout_lines }}"
-    when: init_system.stdout == 'systemd'
+    when: ansible_service_mgr == 'systemd'
 
   # before infernalis release, using sysvinit scripts
   # we use this test so we do not have to know which RPM contains the boot script
 
   - name: stop ceph osds
     shell: "service ceph status osd ; if [ $? == 0 ] ; then service ceph stop osd ; else echo ; fi"
-    when: init_system.stdout == 'sysvinit'
+    when: ansible_service_mgr == 'sysvinit'
 
   - name: stop ceph osds on ubuntu
     shell: |
         initctl stop ceph-osd cluster={{ cluster }} id=$id
       done
     failed_when: false
-    when: init_system.stdout == 'upstart'
+    when: ansible_service_mgr == 'upstart'
     with_items: "{{ osd_ids.stdout_lines }}"
 
   - name: see if ceph-disk-created data partitions are present
       name: ceph-mon@{{ ansible_hostname }}
       state: stopped
       enabled: no
-    when: init_system.stdout == 'systemd'
+    when: ansible_service_mgr == 'systemd'
 
   - name: stop ceph mons
     shell: "service ceph status mon ; if [ $? == 0 ] ; then service ceph stop mon ; else echo ; fi"
-    when: init_system.stdout == 'sysvinit'
+    when: ansible_service_mgr == 'sysvinit'
 
   - name: stop ceph mons on ubuntu
     command: initctl stop ceph-mon cluster={{ cluster }} id={{ ansible_hostname }}
     failed_when: false
-    when: init_system.stdout == 'upstart'
+    when: ansible_service_mgr == 'upstart'
 
   - name: remove monitor store and bootstrap keys
     file:
 
   - name: remove from sysv
     shell: "update-rc.d -f ceph remove"
-    when: init_system.stdout == 'sysvinit'
+    when: ansible_service_mgr == 'sysvinit'
 
   - name: remove upstart and sysv files
     shell: "find /etc -name '*ceph*' -delete"
-    when: init_system.stdout == 'upstart'
+    when: ansible_service_mgr == 'upstart'
 
   - name: remove upstart and apt logs and cache
     shell: "find /var -name '*ceph*' -delete"