2018-07-18 21:59:22 +08:00
---
2018-11-10 01:20:05 +08:00
- name : devices validation
block :
2019-06-07 16:50:28 +08:00
- name : get devices information
2018-11-10 01:20:05 +08:00
parted :
device : "{{ item }}"
unit : MiB
register : devices_parted
2019-06-07 16:50:28 +08:00
failed_when : False
2018-11-10 01:20:05 +08:00
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 :
validate: improve message printed in check_devices.yml
The message prints the whole content of the registered variable in the
playbook, this is not needed and makes the message pretty unclear and
unreadable.
```
"msg": "{'_ansible_parsed': True, 'changed': False, '_ansible_no_log': False, u'err': u'Error: Could not stat device /dev/sdf - No such file or directory.\\n', 'item': u'/dev/sdf', '_ansible_item_result': True, u'failed': False, '_ansible_item_label': u'/dev/sdf', u'msg': u\"Error while getting device information with parted script: '/sbin/parted -s -m /dev/sdf -- unit 'MiB' print'\", u'rc': 1, u'invocation': {u'module_args': {u'part_start': u'0%', u'part_end': u'100%', u'name': None, u'align': u'optimal', u'number': None, u'label': u'msdos', u'state': u'info', u'part_type': u'primary', u'flags': None, u'device': u'/dev/sdf', u'unit': u'MiB'}}, 'failed_when_result': False, '_ansible_ignore_errors': None, u'out': u''} is not a block special file!"
```
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1719023
(cherry picked from commit e6dc3ebd8c8161e56c0a4a1fdb409272b9fd5342)
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2019-07-10 21:08:39 +08:00
msg : "{{ item.item }} is not a block special file!"
2019-06-07 16:50:28 +08:00
when : item.rc is defined
2018-11-10 01:20:05 +08:00
with_items : "{{ devices_parted.results }}"
2018-07-18 21:59:22 +08:00
when :
2018-11-10 01:20:05 +08:00
- devices is defined
2018-07-18 21:59:22 +08:00
2019-06-07 16:50:28 +08:00
- name : get dedicated_device information
2018-07-18 21:59:22 +08:00
parted :
device : "{{ item }}"
unit : MiB
register : dedicated_device_parted
2019-06-07 16:50:28 +08:00
failed_when : False
2018-07-18 23:46:27 +08:00
with_items : "{{ dedicated_devices }}"
2018-07-18 21:59:22 +08:00
when :
- osd_scenario == 'non-collocated'
- name : fail if one of the dedicated_device is not a device
fail :
validate: improve message printed in check_devices.yml
The message prints the whole content of the registered variable in the
playbook, this is not needed and makes the message pretty unclear and
unreadable.
```
"msg": "{'_ansible_parsed': True, 'changed': False, '_ansible_no_log': False, u'err': u'Error: Could not stat device /dev/sdf - No such file or directory.\\n', 'item': u'/dev/sdf', '_ansible_item_result': True, u'failed': False, '_ansible_item_label': u'/dev/sdf', u'msg': u\"Error while getting device information with parted script: '/sbin/parted -s -m /dev/sdf -- unit 'MiB' print'\", u'rc': 1, u'invocation': {u'module_args': {u'part_start': u'0%', u'part_end': u'100%', u'name': None, u'align': u'optimal', u'number': None, u'label': u'msdos', u'state': u'info', u'part_type': u'primary', u'flags': None, u'device': u'/dev/sdf', u'unit': u'MiB'}}, 'failed_when_result': False, '_ansible_ignore_errors': None, u'out': u''} is not a block special file!"
```
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1719023
(cherry picked from commit e6dc3ebd8c8161e56c0a4a1fdb409272b9fd5342)
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2019-07-10 21:08:39 +08:00
msg : "{{ item.item }} is not a block special file!"
2018-07-18 21:59:22 +08:00
with_items : "{{ dedicated_device_parted.results }}"
2018-07-18 23:46:27 +08:00
when :
- osd_scenario == 'non-collocated'
2019-06-07 16:50:28 +08:00
- item.rc is defined
2018-07-18 21:59:22 +08:00
2018-11-10 01:20:05 +08:00
- name : fail if number of dedicated_devices is not equal to number of devices
2018-07-18 21:59:22 +08:00
fail :
2018-11-10 01:20:05 +08:00
msg : "Number of dedicated_devices must be equal to number of devices. dedicated_devices: {{ dedicated_devices | length }}, devices: {{ devices | length }}"
2018-07-18 21:59:22 +08:00
when :
- osd_scenario == 'non-collocated'
2018-11-10 01:20:05 +08:00
- dedicated_devices|length != devices|length