Puppet Class: psick::lvm

Defined in:
manifests/lvm.pp

Overview

Class psick::lvm

Creates a default lv

Parameters:

  • ensure (String) (defaults to: 'installed')
  • create_default_vg (Boolean) (defaults to: false)
  • default_vg_name (String) (defaults to: 'vg00')
  • default_lv_name (String) (defaults to: 'data')
  • default_lv_options (Hash) (defaults to: {})
  • default_fs_type (String) (defaults to: 'xfs')
  • default_createfs (Boolean) (defaults to: false)
  • install_package (Boolean) (defaults to: true)
  • manage (Boolean) (defaults to: $psick::manage)
  • noop_manage (Boolean) (defaults to: $psick::noop_manage)
  • noop_value (Boolean) (defaults to: $psick::noop_value)


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'manifests/lvm.pp', line 4

class psick::lvm (
  String $ensure  = 'installed',

  Boolean $create_default_vg = false,
  String $default_vg_name    = 'vg00',
  String $default_lv_name    = 'data',
  Hash $default_lv_options   = {},
  String $default_fs_type    = 'xfs',
  Boolean $default_createfs  = false,
  Boolean $install_package   = true,

  Boolean $manage            = $psick::manage,
  Boolean $noop_manage       = $psick::noop_manage,
  Boolean $noop_value        = $psick::noop_value,

) {
  if $manage {
    if $noop_manage {
      noop($noop_value)
    }

    if $install_package {
      package { 'lvm2':
        ensure => $ensure,
      }
    }

    $all_disks = keys($facts['disks'])
    $available_disks = delete($all_disks, $all_disks[0])
    $real_pvs =  $available_disks.map|$k| { "/dev/${k}" }

    if $available_disks != [] and $create_default_vg {
      lvm::volume_group { $default_vg_name:
        physical_volumes => $real_pvs,
      }
      lvm::logical_volume { $default_lv_name:
        volume_group => $default_vg_name,
        createfs     => $default_createfs,
        fs_type      => $default_fs_type,
        *            => $default_lv_options,
      }
    }
  }
}