2016-08-10 06:57:41 +08:00
|
|
|
---
|
|
|
|
- name: check if the device is a partition (autodiscover disks)
|
2016-09-19 22:17:11 +08:00
|
|
|
shell: "readlink -f /dev/{{ item.key }} | 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}$'"
|
2016-08-17 05:49:30 +08:00
|
|
|
with_dict: "{{ ansible_devices }}"
|
2016-08-10 06:57:41 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
2016-10-06 00:16:30 +08:00
|
|
|
register: ispartition_results
|
2016-08-10 06:57:41 +08:00
|
|
|
when:
|
|
|
|
- ansible_devices is defined
|
|
|
|
- item.value.removable == "0"
|
|
|
|
|
|
|
|
- name: check the partition status of the osd disks (autodiscover disks)
|
|
|
|
shell: "parted --script /dev/{{ item.key }} print > /dev/null 2>&1"
|
|
|
|
with_dict: '{{ ansible_devices }}'
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
2016-08-17 05:49:30 +08:00
|
|
|
register: osd_partition_status_results
|
2016-08-10 06:57:41 +08:00
|
|
|
when:
|
|
|
|
- journal_collocation or raw_multi_journal
|
|
|
|
- ansible_devices is defined
|
|
|
|
- item.value.removable == "0"
|
|
|
|
- item.value.partitions|count == 0
|
|
|
|
|
|
|
|
- name: fix partitions gpt header or labels of the osd disks (autodiscover disks)
|
|
|
|
shell: "sgdisk --zap-all --clear --mbrtogpt -- '/dev/{{ item.0.item.key }}' || sgdisk --zap-all --clear --mbrtogpt -- '/dev/{{ item.0.item.key }}'"
|
|
|
|
with_together:
|
2016-08-17 05:49:30 +08:00
|
|
|
- "{{ osd_partition_status_results.results }}"
|
|
|
|
- "{{ ansible_devices }}"
|
2016-08-10 06:57:41 +08:00
|
|
|
changed_when: false
|
|
|
|
when:
|
|
|
|
- journal_collocation
|
|
|
|
- ansible_devices is defined
|
|
|
|
- item.0.item.value.removable == "0"
|
|
|
|
- item.0.item.value.partitions|count == 0
|
|
|
|
- item.0.rc != 0
|
|
|
|
|
|
|
|
- name: check if a partition named 'ceph' exists (autodiscover disks)
|
|
|
|
shell: "parted --script /dev/{{ item.key }} print | egrep -sq '^ 1.*ceph'"
|
2016-08-17 05:49:30 +08:00
|
|
|
with_dict: "{{ ansible_devices }}"
|
2016-08-10 06:57:41 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
2016-08-17 05:49:30 +08:00
|
|
|
register: parted_results
|
2016-08-10 06:57:41 +08:00
|
|
|
when:
|
|
|
|
- ansible_devices is defined
|
|
|
|
- item.value.removable == "0"
|