---
# This playbook purges Ceph
# It removes: packages, configuration files and ALL THE DATA

- hosts:
  - mons
  - osds

  vars:
    devices: [ '/dev/sdb', '/dev/sdc', '/dev/sdd', '/dev/sde', '/dev/sdf' ]
    partitions: [ '1', '2', '3' ]

  tasks:

  - name: disk zap
    command: /usr/sbin/sgdisk --zap-all --clear --mbrtogpt -g -- {{ item }}
    with_items: devices
    failed_when: false

  - name: disk zap
    command: /usr/sbin/sgdisk --zap-all --clear --mbrtogpt -g -- {{ item }}
    with_items: devices
    failed_when: false

  - name: call partprobe
    command: partprobe

  - name: purge ceph
    command: ceph-deploy purge {{ ansible_fqdn }}
    delegate_to: 127.0.0.1

  - name: remove osd data
    shell: rm -rf /var/lib/ceph/osd/*/*
    failed_when: false

  - name: purge remaining data
    command: ceph-deploy purgedata {{ ansible_fqdn }}
    delegate_to: 127.0.0.1

---
# This playbook purges Ceph
# It removes: packages, configuration files and ALL THE DATA

- hosts:
  - mons
  - osds

  vars:
    devices: [ '/dev/sdb', '/dev/sdc', '/dev/sdd', '/dev/sde', '/dev/sdf' ]
    partitions: [ '1', '2', '3' ]

  tasks:

  - name: disk zap
    command: /usr/sbin/sgdisk --zap-all --clear --mbrtogpt -g -- {{ item }}
    with_items: devices
    failed_when: false

  - name: disk zap
    command: /usr/sbin/sgdisk --zap-all --clear --mbrtogpt -g -- {{ item }}
    with_items: devices
    failed_when: false

  - name: purge ceph
    command: ceph-deploy purge {{ ansible_fqdn }}
    delegate_to: 127.0.0.1

  - name: remove osd data
    shell: rm -rf /var/lib/ceph/osd/*/*
    failed_when: false

  - name: purge remaining data
    command: ceph-deploy purgedata {{ ansible_fqdn }}
    delegate_to: 127.0.0.1

  - name: call partprobe
    command: partprobe

Move parted to the end of the playbook
Move parted to the end of the playbook

If we call partprobe directly after the partition deletion the task will
get stucked.

Signed-off-by: Sébastien Han <62d754cc350e84d3b1c32ae79f976f5348e74a40@redhat.com>
