ceph-ansible/roles/ceph-osd/tasks/check_devices.yml

20 lines
913 B
YAML
Raw Normal View History

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
# As as a final word, I prefer to keep the partition check instead of running ceph-disk prepare with "ignore_errors: True"
# I believe it's safer
- name: check if the device is a partition or a disk
2014-09-05 03:14:11 +08:00
shell: "echo '{{ item }}' | egrep '/dev/(([a-z]{3,4}[0-9]$)|(cciss/c[0-9]{1}d[0-9]{1}p[0-9]$))'"
ignore_errors: true
with_items: devices
register: ispartition
changed_when: False
- name: if partition named 'ceph' exists
2014-09-05 03:14:11 +08:00
shell: "parted --script {{ item }} print | egrep -sq '^ 1.*ceph'"
ignore_errors: True
with_items: devices
register: parted
changed_when: False