Hello I am trying to write a role that can ensure the exitence of a disk before creating the volume group.
- name: "create a volume group if a disk exists"
become: yes
block:
- name: listing of pvs
shell: " pvs --noheadings -o pv_name"
register: pv_name
- name: "VG | volume group creation"
lvg:
vg: "{{ configure_vg['name'] }}"
pvs: "{{ configure_vg['pvs'] | default(configure_os_pvs) }}"
when: configure_vg['pvs'] in pv_name.stdout
briefly I need to create a volume group from an existant physical volume with ansible
exemple:
[root@rhel ~]# vgcreate LVMvgTEST /dev/sdb /dev/sdc
Volume group "LVMvgTEST" successfully created