Improve purge playbook

We run a zap twice here since we can't combine with_items and
with_sequence yet. This will land in Ansible 2.0. We destroy all the
partitions and re-create new labels as well. We do this twice just
because sometimes one is not sufficient. We also call partprobe to make
sure that the kernel sees the changes.

Signed-off-by: leseb <seb@redhat.com>
pull/324/head
leseb 2015-07-08 10:34:16 +02:00
parent 8aaf879a71
commit e249098f7b
1 changed files with 16 additions and 10 deletions

View File

@ -12,21 +12,27 @@
tasks: tasks:
- name: Purge Ceph - name: disk zap
command: /usr/sbin/sgdisk --zap-all --clear --mbrtogpt -g -- {{ item }}
with_items: devices
ignore_errors: true
- name: disk zap
command: /usr/sbin/sgdisk --zap-all --clear --mbrtogpt -g -- {{ item }}
with_items: devices
ignore_errors: true
- name: call partprobe
command: partprobe
- name: purge ceph
command: ceph-deploy purge {{ ansible_fqdn }} command: ceph-deploy purge {{ ansible_fqdn }}
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
- name: Remove OSD data - name: remove osd data
shell: rm -rf /var/lib/ceph/osd/*/* shell: rm -rf /var/lib/ceph/osd/*/*
ignore_errors: true ignore_errors: true
- name: Purge remaining data - name: purge remaining data
command: ceph-deploy purgedata {{ ansible_fqdn }} command: ceph-deploy purgedata {{ ansible_fqdn }}
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
- name: Purge partitions
shell: parted -s {{ item[0] }} rm {{ item[1] }}
with_nested:
- devices
- partitions
ignore_errors: true