2018-07-18 21:59:22 +08:00
|
|
|
---
|
2018-11-10 01:20:05 +08:00
|
|
|
- name: devices validation
|
2019-04-01 23:46:15 +08:00
|
|
|
when: devices is defined
|
2018-11-10 01:20:05 +08:00
|
|
|
block:
|
|
|
|
- name: validate devices is actually a device
|
|
|
|
parted:
|
|
|
|
device: "{{ item }}"
|
|
|
|
unit: MiB
|
|
|
|
register: devices_parted
|
|
|
|
with_items: "{{ devices }}"
|
2018-07-18 21:59:22 +08:00
|
|
|
|
2018-11-10 01:20:05 +08:00
|
|
|
- name: fail if one of the devices is not a device
|
|
|
|
fail:
|
|
|
|
msg: "{{ item }} is not a block special file!"
|
2019-04-01 23:46:15 +08:00
|
|
|
when: item.failed
|
2018-11-10 01:20:05 +08:00
|
|
|
with_items: "{{ devices_parted.results }}"
|