Puppet Class: ganeti

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

Overview

Class ganeti

Install ganeti

Parameters:

with_drbd: Boolean. Indicates if drbd should be configured. Defaults to true

Actions:

Install ganeti and configure modules/LVM. Does NOT initialize a cluster

Requires:

Sample Usage

include ganeti

Parameters:

  • certname (String)
  • with_drbd (Boolean) (defaults to: true)
  • ganeti216 (Boolean) (defaults to: false)


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
83
84
85
86
87
88
89
90
91
92
# File 'modules/ganeti/manifests/init.pp', line 15

class ganeti(
    String $certname,
    Boolean $with_drbd=true,
    Boolean $ganeti216=false,
) {
    include ::ganeti::kvm

    if $ganeti216 and debian::codename::eq('stretch') {
        # apt::package_from_component { 'ganeti216':
        #     component => 'component/ganeti216',
        #     packages  => ['ganeti', 'ganeti-2.16', 'ganeti-haskell-2.16', 'ganeti-htools-2.16'],
        # }
        apt::repository { 'repository_ganeti216':
            uri        => 'http://apt.wikimedia.org/wikimedia',
            dist       => 'stretch-wikimedia',
            components => 'component/ganeti216',
        }
    } else {
        ensure_packages('ganeti')
    }

    # We're not using ganeti-instance-debootstrap to create images (we PXE-boot
    # the same images we use for baremetal servers), but /usr/share/ganeti/os/debootstrap
    # is needed as an OS provider for "gnt-instance add"
    ensure_packages(['drbd-utils', 'ovmf', 'ganeti-instance-debootstrap'])

    if $with_drbd {
        kmod::options { 'drbd':
            options => 'minor_count=128 usermode_helper=/bin/true',
        }

        # Enable drbd
        kmod::module { 'drbd':
            ensure => 'present',
        }

        # Disable the systemd service shipped with the drbd package. Ganeti handles
        # DRBD on its own
        service { 'drbd':
            ensure => 'stopped',
            enable => false,
        }
    }

    # Enable vhost_net
    kmod::module { 'vhost_net':
        ensure => 'present',
    }

    # lvm.conf
    # Note: We deviate from the default lvm.conf to change the filter config to
    # not include all block devices. TODO: Do it via augeas
    file { '/etc/lvm/lvm.conf' :
        ensure => present,
        owner  => 'root',
        group  => 'root',
        mode   => '0644',
        source => 'puppet:///modules/ganeti/lvm.conf',
    }

    # Deploy defaults (for now, configuring RAPI) and the certificates for RAPI.
    # Potential fixme: We don't restart the daemon here since it's not independent
    # and this file configures other aspects of Ganeti. Manually restart ganeti
    # on the target hosts after changes are merged.
    file { '/etc/default/ganeti':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0644',
        content => template('ganeti/etc_default_ganeti.erb')
    }

    sslcert::certificate { $certname:
        ensure     => present,
        group      => 'gnt-admin',
        use_cergen => true,
    }
}