Puppet Class: labs_lvm

Defined in:
modules/labs_lvm/manifests/init.pp

Overview

Parameters:

  • disk (Stdlib::Unixpath) (defaults to: '/dev/sda')
  • ephemeral (Boolean) (defaults to: false)


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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'modules/labs_lvm/manifests/init.pp', line 13

class labs_lvm(
    Stdlib::Unixpath $disk      = '/dev/sda',
    Boolean          $ephemeral = false,
) {

    package { ['lvm2', 'parted']:
        ensure => present,
    }

    file { '/usr/local/sbin/make-instance-vg':
        ensure  => file,
        source  => 'puppet:///modules/labs_lvm/make-instance-vg.sh',
        require => Package['lvm2', 'parted'],
        mode    => '0544',
        owner   => 'root',
        group   => 'root',
    }

    file { '/usr/local/sbin/make-instance-vg-ephem':
        ensure  => file,
        source  => 'puppet:///modules/labs_lvm/make-instance-vg-ephem.sh',
        require => Package['lvm2'],
        mode    => '0544',
        owner   => 'root',
        group   => 'root',
    }

    file { '/usr/local/sbin/pv-free':
        ensure  => file,
        source  => 'puppet:///modules/labs_lvm/pv-free.py',
        require => Package['lvm2', 'parted'],
        mode    => '0544',
        owner   => 'root',
        group   => 'root',
    }

    file { '/usr/local/sbin/make-instance-vol':
        ensure  => file,
        source  => 'puppet:///modules/labs_lvm/make-instance-vol.sh',
        require => Package['lvm2'],
        mode    => '0544',
        owner   => 'root',
        group   => 'root',
    }

    file { '/usr/local/sbin/extend-instance-vol':
        ensure  => file,
        source  => 'puppet:///modules/labs_lvm/extend-instance-vol.sh',
        require => Package['lvm2'],
        mode    => '0544',
        owner   => 'root',
        group   => 'root',
    }

    if $ephemeral {
        exec { 'create-volume-group':
            logoutput => 'on_failure',
            unless    => '/sbin/vgdisplay -c vd',
            require   => File['/usr/local/sbin/make-instance-vg-ephem'],
            command   => "/usr/local/sbin/make-instance-vg-ephem '${disk}'",
        }
    } else {
        exec { 'create-volume-group':
            logoutput => 'on_failure',
            unless    => '/sbin/vgdisplay -c vd',
            require   => File['/usr/local/sbin/make-instance-vg'],
            command   => "/usr/local/sbin/make-instance-vg '${disk}'",
        }
    }
}