2015-10-21 06:28:35 +08:00
|
|
|
---
|
|
|
|
# This playbook purges a containerized Ceph cluster
|
|
|
|
# It removes: packages, configuration files and ALL THE DATA
|
|
|
|
|
|
|
|
- hosts:
|
|
|
|
- mons
|
|
|
|
- osds
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
2016-04-25 22:40:41 +08:00
|
|
|
- name: install the latest version of gdisk
|
|
|
|
package:
|
|
|
|
name: gdisk
|
|
|
|
state: present
|
|
|
|
|
2015-10-21 06:28:35 +08:00
|
|
|
- name: collect ceph containers
|
2016-04-25 22:40:41 +08:00
|
|
|
shell: docker ps -aq --filter="ancestor=ceph/daemon"
|
2015-10-21 06:28:35 +08:00
|
|
|
register: containers
|
|
|
|
|
|
|
|
- name: delete ceph containers
|
|
|
|
shell: docker rm -f {{ item }}
|
|
|
|
with_items: containers.stdout_lines
|
|
|
|
|
|
|
|
- name: purge ceph directories
|
2016-04-25 22:40:41 +08:00
|
|
|
file:
|
|
|
|
path: {{ item }}
|
|
|
|
state: absent
|
2015-10-21 06:28:35 +08:00
|
|
|
with_items:
|
2016-04-25 22:40:41 +08:00
|
|
|
- /etc/ceph/
|
|
|
|
- /var/lib/ceph/
|
2015-10-21 06:28:35 +08:00
|
|
|
|
|
|
|
- hosts:
|
|
|
|
- osds
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: disk zap
|
2016-04-25 22:40:41 +08:00
|
|
|
command: sgdisk --zap-all --clear --mbrtogpt -g -- {{ item }}
|
|
|
|
with_items: ceph_osd_docker_devices
|
2015-10-21 06:28:35 +08:00
|
|
|
|
|
|
|
- name: disk zap again
|
2016-04-25 22:40:41 +08:00
|
|
|
command: sgdisk --zap-all --clear --mbrtogpt -g -- {{ item }}
|
|
|
|
with_items: ceph_osd_docker_devices
|