Merge pull request #1284 from ceph/BZ-1418980

purge-cluster: do not use ceph-detect-init
pull/1298/head
Andrew Schoen 2017-02-08 08:46:03 -06:00 committed by GitHub
commit 5ddfc4f85c
1 changed files with 26 additions and 77 deletions

View File

@ -31,7 +31,7 @@
invoking the playbook" invoking the playbook"
when: ireallymeanit != 'yes' when: ireallymeanit != 'yes'
- name: gather facts and check init system - name: gather facts on all hosts
vars: vars:
mon_group_name: mons mon_group_name: mons
@ -54,9 +54,7 @@
become: true become: true
tasks: tasks:
- name: detect init system - debug: msg="gather facts on all Ceph hosts for following reference"
command: ceph-detect-init
register: init_system
- name: purge ceph mds cluster - name: purge ceph mds cluster
@ -71,28 +69,22 @@
become: true become: true
tasks: tasks:
- include_vars: roles/ceph-common/defaults/main.yml
- include_vars: roles/ceph-mds/defaults/main.yml
- include_vars: group_vars/all.yml
ignore_errors: true
- include_vars: group_vars/{{ mds_group_name }}.yml
ignore_errors: true
- name: stop ceph mdss with systemd - name: stop ceph mdss with systemd
service: service:
name: ceph-mds@{{ ansible_hostname }} name: ceph-mds@{{ ansible_hostname }}
state: stopped state: stopped
enabled: no enabled: no
when: init_system.stdout == 'systemd' when: ansible_service_mgr == 'systemd'
- name: stop ceph mdss - name: stop ceph mdss
shell: "service ceph status mds ; if [ $? == 0 ] ; then service ceph stop mds ; else echo ; fi" 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 - name: stop ceph mdss on ubuntu
command: initctl stop ceph-mds cluster={{ cluster }} id={{ ansible_hostname }} command: initctl stop ceph-mds cluster={{ cluster }} id={{ ansible_hostname }}
failed_when: false failed_when: false
when: init_system.stdout == 'upstart' when: ansible_service_mgr == 'upstart'
- name: purge ceph rgw cluster - name: purge ceph rgw cluster
@ -108,28 +100,22 @@
become: true become: true
tasks: tasks:
- include_vars: roles/ceph-common/defaults/main.yml
- include_vars: roles/ceph-rgw/defaults/main.yml
- include_vars: group_vars/all.yml
ignore_errors: true
- include_vars: group_vars/{{ rgw_group_name }}.yml
ignore_errors: true
- name: stop ceph rgws with systemd - name: stop ceph rgws with systemd
service: service:
name: ceph-radosgw@rgw.{{ ansible_hostname }} name: ceph-radosgw@rgw.{{ ansible_hostname }}
state: stopped state: stopped
enabled: no enabled: no
when: init_system.stdout == 'systemd' when: ansible_service_mgr == 'systemd'
- name: stop ceph rgws - name: stop ceph rgws
shell: "service ceph-radosgw status ; if [ $? == 0 ] ; then service ceph-radosgw stop ; else echo ; fi" 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 - name: stop ceph rgws on ubuntu
command: initctl stop radosgw cluster={{ cluster }} id={{ ansible_hostname }} command: initctl stop radosgw cluster={{ cluster }} id={{ ansible_hostname }}
failed_when: false failed_when: false
when: init_system.stdout == 'upstart' when: ansible_service_mgr == 'upstart'
- name: purge ceph rbd-mirror cluster - name: purge ceph rbd-mirror cluster
@ -145,23 +131,17 @@
become: true become: true
tasks: tasks:
- include_vars: roles/ceph-common/defaults/main.yml
- include_vars: roles/ceph-rbd-mirror/defaults/main.yml
- include_vars: group_vars/all.yml
ignore_errors: true
- include_vars: group_vars/{{ rbdmirror_group_name }}.yml
ignore_errors: true
- name: stop ceph rbd mirror with systemd - name: stop ceph rbd mirror with systemd
service: service:
name: ceph-rbd-mirror@admin.service name: ceph-rbd-mirror@admin.service
state: stopped state: stopped
when: init_system.stdout == 'systemd' when: ansible_service_mgr == 'systemd'
- name: stop ceph rbd mirror on ubuntu - name: stop ceph rbd mirror on ubuntu
command: initctl stop ceph-rbd-mirror cluster={{ cluster }} id=admin command: initctl stop ceph-rbd-mirror cluster={{ cluster }} id=admin
failed_when: false failed_when: false
when: init_system.stdout == 'upstart' when: ansible_service_mgr == 'upstart'
- name: purge ceph nfs cluster - name: purge ceph nfs cluster
@ -177,27 +157,21 @@
become: true become: true
tasks: tasks:
- include_vars: roles/ceph-common/defaults/main.yml
- include_vars: roles/ceph-nfs/defaults/main.yml
- include_vars: group_vars/all.yml
ignore_errors: true
- include_vars: group_vars/{{ nfs_group_name }}.yml
ignore_errors: true
- name: stop ceph nfss with systemd - name: stop ceph nfss with systemd
service: service:
name: nfs-ganesha name: nfs-ganesha
state: stopped state: stopped
when: init_system.stdout == 'systemd' when: ansible_service_mgr == 'systemd'
- name: stop ceph nfss - name: stop ceph nfss
shell: "service nfs-ganesha status ; if [ $? == 0 ] ; then service nfs-ganesha stop ; else echo ; fi" 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 - name: stop ceph nfss on ubuntu
command: initctl stop nfs-ganesha command: initctl stop nfs-ganesha
failed_when: false failed_when: false
when: init_system.stdout == 'upstart' when: ansible_service_mgr == 'upstart'
- name: purge ceph osd cluster - name: purge ceph osd cluster
@ -229,10 +203,6 @@
state: absent state: absent
tasks: tasks:
- include_vars: group_vars/all.yml
ignore_errors: true
- include_vars: group_vars/{{ osd_group_name }}.yml
ignore_errors: true
- name: check for a device list - name: check for a device list
fail: fail:
@ -252,7 +222,7 @@
state: stopped state: stopped
enabled: no enabled: no
with_items: "{{ osd_ids.stdout_lines }}" with_items: "{{ osd_ids.stdout_lines }}"
when: init_system.stdout == 'systemd' when: ansible_service_mgr == 'systemd'
# before infernalis release, using sysvinit scripts # before infernalis release, using sysvinit scripts
# we use this test so we do not have to know which RPM contains the boot script # we use this test so we do not have to know which RPM contains the boot script
@ -260,7 +230,7 @@
- name: stop ceph osds - name: stop ceph osds
shell: "service ceph status osd ; if [ $? == 0 ] ; then service ceph stop osd ; else echo ; fi" 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 - name: stop ceph osds on ubuntu
shell: | shell: |
@ -268,7 +238,7 @@
initctl stop ceph-osd cluster={{ cluster }} id=$id initctl stop ceph-osd cluster={{ cluster }} id=$id
done done
failed_when: false failed_when: false
when: init_system.stdout == 'upstart' when: ansible_service_mgr == 'upstart'
with_items: "{{ osd_ids.stdout_lines }}" with_items: "{{ osd_ids.stdout_lines }}"
- name: see if ceph-disk-created data partitions are present - name: see if ceph-disk-created data partitions are present
@ -397,31 +367,22 @@
become: true become: true
tasks: tasks:
- include_vars: roles/ceph-common/defaults/main.yml
- include_vars: roles/ceph-mon/defaults/main.yml
- include_vars: roles/ceph-restapi/defaults/main.yml
- include_vars: group_vars/all.yml
ignore_errors: true
- include_vars: group_vars/{{ mon_group_name }}.yml
ignore_errors: true
- include_vars: group_vars/{{ restapi_group_name }}.yml
ignore_errors: true
- name: stop ceph mons with systemd - name: stop ceph mons with systemd
service: service:
name: ceph-mon@{{ ansible_hostname }} name: ceph-mon@{{ ansible_hostname }}
state: stopped state: stopped
enabled: no enabled: no
when: init_system.stdout == 'systemd' when: ansible_service_mgr == 'systemd'
- name: stop ceph mons - name: stop ceph mons
shell: "service ceph status mon ; if [ $? == 0 ] ; then service ceph stop mon ; else echo ; fi" 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 - name: stop ceph mons on ubuntu
command: initctl stop ceph-mon cluster={{ cluster }} id={{ ansible_hostname }} command: initctl stop ceph-mon cluster={{ cluster }} id={{ ansible_hostname }}
failed_when: false failed_when: false
when: init_system.stdout == 'upstart' when: ansible_service_mgr == 'upstart'
- name: remove monitor store and bootstrap keys - name: remove monitor store and bootstrap keys
file: file:
@ -555,11 +516,11 @@
- name: remove from sysv - name: remove from sysv
shell: "update-rc.d -f ceph remove" shell: "update-rc.d -f ceph remove"
when: init_system.stdout == 'sysvinit' when: ansible_service_mgr == 'sysvinit'
- name: remove upstart and sysv files - name: remove upstart and sysv files
shell: "find /etc -name '*ceph*' -delete" shell: "find /etc -name '*ceph*' -delete"
when: init_system.stdout == 'upstart' when: ansible_service_mgr == 'upstart'
- name: remove upstart and apt logs and cache - name: remove upstart and apt logs and cache
shell: "find /var -name '*ceph*' -delete" shell: "find /var -name '*ceph*' -delete"
@ -609,23 +570,11 @@
gather_facts: false gather_facts: false
tasks: tasks:
- include_vars: roles/ceph-common/defaults/main.yml
- include_vars: group_vars/all.yml - name: set fetch_directory value if not set
ignore_errors: true set_fact:
- include_vars: group_vars/{{ mds_group_name }}.yml fetch_directory: "fetch/"
ignore_errors: true when: fetch_directory is not defined
- include_vars: group_vars/{{ rgw_group_name }}.yml
ignore_errors: true
- include_vars: group_vars/{{ rbdmirror_group_name }}.yml
ignore_errors: true
- include_vars: group_vars/{{ nfs_group_name }}.yml
ignore_errors: true
- include_vars: group_vars/{{ osd_group_name }}.yml
ignore_errors: true
- include_vars: group_vars/{{ mon_group_name }}.yml
ignore_errors: true
- include_vars: group_vars/{{ restapi_group_name }}.yml
ignore_errors: true
- name: purge fetch directory for localhost - name: purge fetch directory for localhost
file: file: