# Creating LVG's and LVs in Azure

**URL:** <https://forum.ansible.com/t/creating-lvgs-and-lvs-in-azure/34323>\
**Category:** Ansible Project\
**Tags:** azure\
**Created:** [December 11, 2020, 9:28pm UTC](https://forum.ansible.com/t/creating-lvgs-and-lvs-in-azure/34323 "2020-12-11T21:28:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave\_McPherson](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dave_mcpherson/32/6973_2.png) [@Dave\_McPherson](https://forum.ansible.com/u/Dave_McPherson)\
**Post date:** [December 11, 2020, 9:28pm UTC](https://forum.ansible.com/t/creating-lvgs-and-lvs-in-azure/34323/1 "2020-12-11T21:28:30Z")

</div>

I have a post install script to partition and then add disk to Volume groups then create volumes in Azure. The parted portion of the script works fine but I get an error attempting to create the volume groups. Any help would be appreciated.

Thanks,

Dave

- name: Partition disk  
parted:  
device: “/dev/disk/azure/scsi1/lun{{ item.lun }}”  
name: 1  
number: 1  
label: gpt  
state: present  
with\_items:
- “{{ extra\_disks }}”

when: item.lun is defined

- name: “Make U01”  
lvg:  
pvs: “/dev/disk/azure/scsi1/lun{{ u01.lun }}-part1”  
vg: “vg\_{{ u01.vg }}”

when: u01.vg != “None”

- name: Make backups logical volume group  
lvg:  
pvs: “/dev/disk/azure/scsi1/lun{{ backups.lun }}-part1”  
vg: “vg\_{{ backups.vg }}”  
when: backups.vg != “None”

The disk definition file looks like this:

extra\_disks:

- { size: 512, type: Premium\_LRS, lun: 0, name: u01 }
- { size: 8192, type: Premium\_LRS, lun: 1, name: backups }
- { size: 1024, type: Premium\_LRS, lun: 2, name: ASMSR1PRDA }
- { size: 1024, type: Premium\_LRS, lun: 3, name: ASMSR1PRDB }
- { size: 1024, type: Premium\_LRS, lun: 4, name: ASMSR1PRDC }
- { size: 1024, type: Premium\_LRS, lun: 5, name: ASMSR1PRDD }
- { size: 1024, type: Premium\_LRS, lun: 6, name: ASMSR1PRDE }
- { size: 1024, type: Premium\_LRS, lun: 7, name: ASMSR1PRDF }
- { size: 1024, type: Premium\_LRS, lun: 8, name: ASMSR1PRDG }
- { size: 1024, type: Premium\_LRS, lun: 9, name: ASMSR1PRDH }
- { size: 1024, type: Premium\_LRS, lun: 10, name: ASMSR1PRDI }
- { size: 1024, type: Premium\_LRS, lun: 11, name: ASMSR1PRDJ }
- { size: 512, type: Premium\_LRS, lun: 12, name: ASMORARCHA }
- { size: 512, type: Premium\_LRS, lun: 13, name: ASMORARCHB }
- { size: 512, type: Premium\_LRS, lun: 14, name: ASMORARCHC }
- { size: 512, type: Premium\_LRS, lun: 15, name: ASMORARCHD }
- { size: 128, type: Premium\_LRS, lun: 16, name: ASMORALOG1A }
- { size: 128, type: Premium\_LRS, lun: 17, name: ASMORALOG2A }
- { size: 512, type: Premium\_LRS, lun: 18, name: ASMORAFLASHA }
- { size: 16, type: Premium\_LRS, lun: 19, name: ASMCRSA }

and the directory of /dev/disk/azure/scsi1 is:

lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun0 → …/…/…/sdx  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun0-part1 → …/…/…/sdx1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun1 → …/…/…/sdc  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun10 → …/…/…/sdq  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun10-part1 → …/…/…/sdq1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun11 → …/…/…/sdj  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun11-part1 → …/…/…/sdj1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun12 → …/…/…/sdf  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun12-part1 → …/…/…/sdf1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun13 → …/…/…/sdd  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun13-part1 → …/…/…/sdd1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun14 → …/…/…/sdl  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun14-part1 → …/…/…/sdl1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun15 → …/…/…/sdm  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun15-part1 → …/…/…/sdm1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun16 → …/…/…/sdu  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun16-part1 → …/…/…/sdu1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun17 → …/…/…/sdh  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun17-part1 → …/…/…/sdh1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun18 → …/…/…/sdv  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun18-part1 → …/…/…/sdv1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun19 → …/…/…/sdn  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun19-part1 → …/…/…/sdn1  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun1-part1 → …/…/…/sdc1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun2 → …/…/…/sde  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun20 → …/…/…/sdk  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun20-part1 → …/…/…/sdk1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun21 → …/…/…/sdr  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun21-part1 → …/…/…/sdr1  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun2-part1 → …/…/…/sde1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun3 → …/…/…/sdg  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun3-part1 → …/…/…/sdg1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun4 → …/…/…/sdw  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun4-part1 → …/…/…/sdw1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun5 → …/…/…/sdp  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun5-part1 → …/…/…/sdp1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun6 → …/…/…/sdo  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun6-part1 → …/…/…/sdo1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun7 → …/…/…/sdi  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun7-part1 → …/…/…/sdi1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun8 → …/…/…/sds  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun8-part1 → …/…/…/sds1  
lrwxrwxrwx. 1 root root 12 Dec 11 17:54 lun9 → …/…/…/sdt  
lrwxrwxrwx. 1 root root 13 Dec 11 17:54 lun9-part1 → …/…/…/sdt1

---

<div class="post-metadata">

**Author:** ![Dave\_McPherson](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dave_mcpherson/32/6973_2.png) [@Dave\_McPherson](https://forum.ansible.com/u/Dave_McPherson)\
**Post date:** [December 11, 2020, 9:35pm UTC](https://forum.ansible.com/t/creating-lvgs-and-lvs-in-azure/34323/2 "2020-12-11T21:35:28Z")

</div>

I get the following error when attempting to create the U01 vg.

FAILED! =\> {“msg”: “The task includes an option with an undefined variable. The error was: ‘u01’ is undefined\n\nThe error appears to be in ‘/etc/ansible/playbooks/configure\_disk-dave.yml’: line 25, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: "Make U01"\n ^ here\n”}

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [December 11, 2020, 10:02pm UTC](https://forum.ansible.com/t/creating-lvgs-and-lvs-in-azure/34323/3 "2020-12-11T22:02:38Z")

</div>

Hi,

The message is pretty clear, you have no u01 variable defined in you vars file !

So when the line ’ when: u01.vg !=“None”’ evaluate it crashed because u01 is not known…

Don’t know exactly what you want to do, but I saw ASM, so think about Oracle… Not sure mixing asm disk and LVM is a very good idea

Regards,

JYL

---

<div class="post-metadata">

**Author:** ![Eric1](https://avatars.discourse-cdn.com/v4/letter/e/3bc359/32.png) [@Eric1](https://forum.ansible.com/u/Eric1)\
**Post date:** [December 13, 2020, 9:55pm UTC](https://forum.ansible.com/t/creating-lvgs-and-lvs-in-azure/34323/4 "2020-12-13T21:55:17Z")

</div>

Why use LVM in Azure/AWS/VMware, when you can just expand the disk and grow the filesystem?

LVM seems like an unneeded layer.
