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

39 lines
1.4 KiB
YAML

---
- name: check if the device is a partition
shell: "readlink -f {{ item }} | egrep '/dev/([hsv]d[a-z]{1,2}|cciss/c[0-9]d[0-9]p|nvme[0-9]n[0-9]p)[0-9]{1,2}$'"
with_items: "{{ devices }}"
changed_when: false
failed_when: false
register: ispartition_results
- name: check the partition status of the osd disks
shell: "parted --script {{ item }} print > /dev/null 2>&1"
with_items: "{{ devices }}"
changed_when: false
failed_when: false
register: osd_partition_status_results
when:
- journal_collocation or raw_multi_journal
# NOTE: The following calls to sgdisk are retried because sgdisk is known to
# fully wipe a device the first time around. There is no need to halt execution
# of zapping the whole device so these try again. It is easier to use `||` to
# keep the current flow of the task.
# See: https://github.com/ceph/ceph-ansible/issues/759
- name: fix partitions gpt header or labels of the osd disks
shell: "sgdisk --zap-all --clear --mbrtogpt -- {{ item.1 }} || sgdisk --zap-all --clear --mbrtogpt -- {{ item.1 }}"
with_together:
- "{{ osd_partition_status_results.results }}"
- "{{ devices }}"
changed_when: false
when:
- journal_collocation or raw_multi_journal
- item.0.rc != 0
- name: check if a partition named 'ceph' exists
shell: "parted --script {{ item }} print | egrep -sq '^ 1.*ceph'"
with_items: "{{ devices }}"
changed_when: false
failed_when: false
register: parted_results