2014-09-05 03:14:11 +08:00
|
|
|
---
|
|
|
|
# NOTE (leseb): current behavior of ceph-disk is to fail when the device is mounted "stderr: ceph-disk: Error: Device is mounted: /dev/sdb1"
|
|
|
|
# the return code is 1, which makes sense, however ideally if ceph-disk will detect a ceph partition
|
|
|
|
# it should exist we rc=0 and don't do anything unless we do something like --force
|
2015-07-29 00:21:15 +08:00
|
|
|
# As as a final word, I prefer to keep the partition check instead of running ceph-disk prepare with "failed_when: false"
|
2014-09-05 03:14:11 +08:00
|
|
|
# I believe it's safer
|
2015-10-07 23:40:10 +08:00
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
- name: check if the device is a partition or a disk
|
2015-10-07 23:40:10 +08:00
|
|
|
shell: "echo '{{ item }}' | egrep '/dev/[sd[a-z]{1,2}|hd[a-z]{1,2}|cciss/c[0-9]d[0-9]p|nvme[0-9]n[0-9]p][0-9]{1,2}'"
|
2014-09-05 03:14:11 +08:00
|
|
|
with_items: devices
|
2015-06-26 06:26:03 +08:00
|
|
|
changed_when: false
|
2015-07-29 00:21:15 +08:00
|
|
|
failed_when: false
|
2014-09-05 03:14:11 +08:00
|
|
|
register: ispartition
|
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
- name: if partition named 'ceph' exists
|
2014-09-05 03:14:11 +08:00
|
|
|
shell: "parted --script {{ item }} print | egrep -sq '^ 1.*ceph'"
|
|
|
|
with_items: devices
|
2015-06-26 06:26:03 +08:00
|
|
|
changed_when: false
|
2015-07-29 00:21:15 +08:00
|
|
|
failed_when: false
|
2014-09-05 03:14:11 +08:00
|
|
|
register: parted
|