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

44 lines
1.8 KiB
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 "failed_when: false"
2014-09-05 03:14:11 +08:00
# I believe it's safer
#
# regex syntax uses (pat1|pat2|...|patN) for different families of device
# names, but has a common expression for partition number at the end.
# allow 2-digit partition numbers so fast SSDs can be shared by > 9 disks
# for SSD journals.
- include: ./check_devices_static.yml
when:
- not osd_auto_discovery
- not osd_directory
# Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent)
static: False
- include: ./check_devices_auto.yml
when:
- osd_auto_discovery
- not osd_directory
# Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent)
static: False
- name: check the partition status of the journal devices
shell: "parted --script {{ item }} print > /dev/null 2>&1"
with_items: "{{ raw_journal_devices|unique }}"
changed_when: false
failed_when: false
register: journal_partition_status
when: raw_multi_journal or dmcrypt_dedicated_journal
- name: fix partitions gpt header or labels of the journal devices
shell: "sgdisk --zap-all --clear --mbrtogpt -- {{ item.1 }} || sgdisk --zap-all --clear --mbrtogpt -- {{ item.1 }}"
with_together:
- "{{ journal_partition_status.results }}"
- "{{ raw_journal_devices|unique }}"
changed_when: false
when:
- raw_multi_journal or dmcrypt_dedicated_journal
- item.0.rc != 0