Puppet Class: profile::wmcs::nfs::test

Defined in:
modules/profile/manifests/wmcs/nfs/test.pp

Overview

Class: profile::wmcs::nfs::test

Sets up a cloudstore NFS server on a Cloud VPS instance in a way to provide a flexible test bed.

Params:

[*main_iface*]
  Usually just eth0, but represents the name of the interface on the instance
  to use for communication. Instances are not likely to have multiple
  interfaces
  Default: eth0

[*active_nfs*]
  Currently active NFS server hostname (not FQDN)

[*nfs_host1*]
  NFS host that is intended to be active in a non-failover situation.

[*nfs_host2*]
  NFS host that is intended to be standby in a non-failover situation.

[*nfs_host1_ip*]
  IPv4 address of the host that is intended to be active in a non-failover
  situation.

[*nfs_host2_ip*]
  IPv4 address of the host that is intended to be standby in a non-failover
  situation.

Parameters:

  • main_iface (String) (defaults to: lookup('profile::wmcs::nfs::test::main_iface', { default_value => 'eth0' }))
  • active_nfs (Stdlib::Host) (defaults to: lookup('profile::wmcs::nfs::test::active_nfs'))
  • nfs_host1 (Stdlib::Host) (defaults to: lookup('profile::wmcs::nfs::test::nfs_host1'))
  • nfs_host2 (Stdlib::Host) (defaults to: lookup('profile::wmcs::nfs::test::nfs_host2'))
  • nfs_host1_ip (Stdlib::IP::Address) (defaults to: lookup('profile::wmcs::nfs::test::nfs_host1_ip'))
  • nfs_host2_ip (Stdlib::IP::Address) (defaults to: lookup('profile::wmcs::nfs::test::nfs_host2_ip'))


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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'modules/profile/manifests/wmcs/nfs/test.pp', line 31

class profile::wmcs::nfs::test(
  String $main_iface = lookup('profile::wmcs::nfs::test::main_iface', { default_value => 'eth0' }),
  Stdlib::Host $active_nfs = lookup('profile::wmcs::nfs::test::active_nfs'),
  Stdlib::Host $nfs_host1 = lookup('profile::wmcs::nfs::test::nfs_host1'),
  Stdlib::Host $nfs_host2 = lookup('profile::wmcs::nfs::test::nfs_host2'),
  Stdlib::IP::Address $nfs_host1_ip = lookup('profile::wmcs::nfs::test::nfs_host1_ip'),
  Stdlib::IP::Address $nfs_host2_ip = lookup('profile::wmcs::nfs::test::nfs_host2_ip'),
) {
    require ::profile::openstack::eqiad1::observerenv

    class {'::labstore':
        nfsd_threads => '8',
    }

    package { [
            'python3-pymysql',
        ]:
        ensure => present,
    }

    sysctl::parameters { 'cloudstore base':
        values   => {
            # Increase TCP max buffer size
            'net.core.rmem_max' => 67108864,
            'net.core.wmem_max' => 67108864,

            # Increase Linux auto-tuning TCP buffer limits
            # Values represent min, default, & max num. of bytes to use.
            'net.ipv4.tcp_rmem' => [ 4096, 87380, 33554432 ],
            'net.ipv4.tcp_wmem' => [ 4096, 65536, 33554432 ],
        },
        priority => 70,
    }

    class {'::labstore::fileserver::exports':
        server_vols   => ['project', 'home'],
    }

    if $facts['hostname'] == $active_nfs {
        $drbd_role = 'primary'
    } else {
        $drbd_role = 'secondary'
    }

    $drbd_resource_config = {
        'test'   => {
            port       => '7790',
            device     => '/dev/drbd1',
            disk       => '/dev/vd/test',
            mount_path => '/srv/test',
        },
        'tools'  => {
            port       => '7791',
            device     => '/dev/drbd4',
            disk       => '/dev/vd/tools-project',
            mount_path => '/srv/tools',
        },
        'misc' => {
            port       => '7792',
            device     => '/dev/drbd3',
            disk       => '/dev/vd/misc-project',
            mount_path => '/srv/misc',
        },
    }

    $drbd_defaults = {
        'drbd_cluster' => {
            $nfs_host1 => $nfs_host1_ip,
            $nfs_host2 => $nfs_host2_ip,
        },
    }

    $cluster_ips_ferm = join([$nfs_host1_ip, $nfs_host2_ip], ' ')
    ferm::service { 'drbd-test':
        proto  => 'tcp',
        port   => '7790',
        srange => "(${cluster_ips_ferm})",
    }

    ferm::service { 'drbd-misc':
        proto  => 'tcp',
        port   => '7791',
        srange => "(${cluster_ips_ferm})",
    }

    ferm::service { 'drbd-tools':
        proto  => 'tcp',
        port   => '7792',
        srange => "(${cluster_ips_ferm})",
    }

    create_resources(labstore::drbd::resource, $drbd_resource_config, $drbd_defaults)

    # state managed manually
    service { 'drbd':
        enable => false,
    }

    # state via nfs-manage
    if os_version('debian >= stretch') {
        service { 'nfs-server':
            enable => false,
        }
        $nfs_start_command = 'systemctl start nfs-server'
        $nfs_stop_command = 'systemctl stop nfs-server'
    } else {
        service { 'nfs-kernel-server':
            enable => false,
        }
        $nfs_start_command = '/usr/sbin/service nfs-kernel-server start'
        $nfs_stop_command = '/usr/sbin/service nfs-kernel-server stop'
    }

    file { '/usr/local/sbin/nfs-manage':
        content => template('profile/wmcs/nfs/nfs-manage.sh.erb'),
        mode    => '0744',
        owner   => 'root',
        group   => 'root',
    }

    file {'/usr/local/sbin/logcleanup':
        source => 'puppet:///modules/labstore/logcleanup.py',
        mode   => '0744',
        owner  => 'root',
        group  => 'root',
    }

    file {'/etc/logcleanup-config.yaml':
        source => 'puppet:///modules/profile/wmcs/nfs/primary/logcleanup-config.yaml',
        mode   => '0644',
        owner  => 'root',
        group  => 'root',
    }
}