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

59 lines
1.7 KiB
YAML

---
- name: devices validation
block:
- name: read information about the devices
parted:
device: "{{ item }}"
unit: MiB
register: parted_results
with_items: "{{ devices }}"
- name: fail when gpt header found on osd devices
fail:
msg: "{{ item.disk.dev }} has gpt header, please remove it."
with_items: "{{ parted_results.results }}"
when:
- item.disk.table == 'gpt'
- item.partitions | length == 0
- name: get devices information
parted:
device: "{{ item }}"
unit: MiB
register: devices_parted
failed_when: False
with_items: "{{ devices }}"
- name: fail if one of the devices is not a device
fail:
msg: "{{ item.item }} is not a block special file!"
when: item.rc is defined
with_items: "{{ devices_parted.results }}"
when:
- devices is defined
- name: get dedicated_device information
parted:
device: "{{ item }}"
unit: MiB
register: dedicated_device_parted
failed_when: False
with_items: "{{ dedicated_devices }}"
when:
- osd_scenario == 'non-collocated'
- name: fail if one of the dedicated_device is not a device
fail:
msg: "{{ item.item }} is not a block special file!"
with_items: "{{ dedicated_device_parted.results }}"
when:
- osd_scenario == 'non-collocated'
- item.rc is defined
- name: fail if number of dedicated_devices is not equal to number of devices
fail:
msg: "Number of dedicated_devices must be equal to number of devices. dedicated_devices: {{ dedicated_devices | length }}, devices: {{ devices | length }}"
when:
- osd_scenario == 'non-collocated'
- dedicated_devices|length != devices|length