Creating LVG's and LVs in Azure

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

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”}

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

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

LVM seems like an unneeded layer.