Using puppet to create a lvm with dynamic size

1.8k views Asked by At

I use below command manually to create a lvm (appslv) with rest 100% size.

lvcreate -l +100%FREE -n appslv appsvg

But with puppet-lvm module I create lvm with below code:

class { 'lvm':
  volume_groups    => {
    'appsvg' => {
      physical_volumes => [ '/dev/xvda5' ],
      logical_volumes  => {
        'appslv' => {
          'size'              => '500G',
          'mountpath'         => '/u01',
          'mountpath_require' => true,
        },

      },
    },
  },
 }

But as the attached size of /dev/xda5 is unknown, I dont want to specify the exact size, as it varries from instance to instance. So How can I specify that in the pp, to use rest 100%

1

There are 1 answers

0
aimnor On

If you don't set any size parameter it will, by default, use all the available space.

source code

if !@resource[:extents] and !@resource[:size] and !@resource[:initial_size]
        args.push('--extents', '100%FREE')
end