Defined Type: snapshot::dumps::datamount

Defined in:
modules/snapshot/manifests/dumps/datamount.pp

Overview

Parameters:

  • mountpoint (Any) (defaults to: undef)
  • mount_type (Any) (defaults to: undef)
  • server (Any) (defaults to: undef)
  • managed_subdirs (Any) (defaults to: [])
  • extra_mountopts (Any) (defaults to: undef)
  • user (Any) (defaults to: undef)
  • group (Any) (defaults to: undef)


1
2
3
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
48
49
# File 'modules/snapshot/manifests/dumps/datamount.pp', line 1

define snapshot::dumps::datamount(
    $mountpoint = undef,
    $mount_type = undef,
    $server = undef,
    $managed_subdirs = [],
    $extra_mountopts = undef,
    $user = undef,
    $group = undef,
) {
    if ($mount_type == 'local' or $mount_type == 'nfs') {
        file { [ $mountpoint ]:
            ensure => 'directory',
        }
    }
    elsif ($mount_type == 'labslvm') {
        labs_lvm::volume { 'data-local-disk':
            mountat => $mountpoint,
        }
    }

    $standard_mountopts = 'bg,hard,tcp,rsize=8192,wsize=8192,intr,nfsvers=3'
    if ($extra_mountopts != '') {
        $mountopts = "${standard_mountopts},${extra_mountopts}"
    } else {
        $mountopts = $standard_mountopts
    }
    if ($mount_type == 'nfs') {
        ensure_packages(['nfs-common'])

        mount { $mountpoint:
            ensure   => 'mounted',
            device   => "${server}:/data",
            fstype   => 'nfs',
            name     => $mountpoint,
            options  => $mountopts,
            require  => File[$mountpoint],
            remounts => false,
        }
    }

    if ($managed_subdirs) {
        file { $managed_subdirs:
            ensure => 'directory',
            mode   => '0755',
            owner  => $user,
            group  => $group,
        }
    }
}