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

43 lines
1.2 KiB
YAML

---
- name: devices validation
block:
- name: validate devices is actually a device
parted:
device: "{{ item }}"
unit: MiB
register: devices_parted
with_items: "{{ devices }}"
- name: fail if one of the devices is not a device
fail:
msg: "{{ item }} is not a block special file!"
when:
- item.failed
with_items: "{{ devices_parted.results }}"
when:
- devices is defined
- name: validate dedicated_device is/are actually device(s)
parted:
device: "{{ item }}"
unit: MiB
register: dedicated_device_parted
with_items: "{{ dedicated_devices }}"
when:
- osd_scenario == 'non-collocated'
- name: fail if one of the dedicated_device is not a device
fail:
msg: "{{ item }} is not a block special file!"
with_items: "{{ dedicated_device_parted.results }}"
when:
- osd_scenario == 'non-collocated'
- item.failed
- 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