infrastructure-playbooks: failure msg for pvcreate

Add a message for when PV creation fails.

This message alerts users that FS/GPT/RAID
signatures could still on the device and the
reason for the failures.

`wipefs -a $device` needs to be run to fix this issue.

Signed-off-by: Ali Maredia <amaredia@redhat.com>
pull/3074/head
Ali Maredia 2018-08-28 15:36:44 -04:00 committed by mergify[bot]
parent ae5ebeeb00
commit e1ff438800
1 changed files with 29 additions and 0 deletions

View File

@ -35,6 +35,19 @@
# Make entire nvme device a VG
- name: add nvme device as lvm pv
lvg:
force: yes
pvs: "{{ nvme_device }}"
pesize: 4
state: present
ignore_errors: True
register: nvme_pv_create
- fail:
msg: "PV creation for {{ nvme_device }} has failed. Please verify the device is ready for use by running `wipefs --all {{ nvme_device }}`"
when: nvme_pv_create.rc != 0
- name: add vg to nvme device pv
lvg:
force: yes
pvs: "{{ nvme_device }}"
@ -69,6 +82,22 @@
- "{{ nvme_device_lvs }}"
# Make sure all hdd devices have a unique volume group
- name: create pvs on all hdd devices
lvg:
force: yes
pvs: "{{ item }}"
pesize: 4
state: present
ignore_errors: True
register: hdd_pv_create
with_items:
- "{{ hdd_devices }}"
- fail:
msg: "PV creation for {{ item.item }} has failed. Please verify the device is ready for use by running `wipefs --all {{ item.item }}`"
when: item.rc != 0
loop: "{{ hdd_pv_create.results }}"
- name: create vgs for all hdd devices
lvg:
force: yes