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
|
# File 'manifests/nfs/mount.pp', line 3
define psick::nfs::mount (
String $server,
String $share,
Enum[present,absent] $ensure = present,
String $mountpoint = '', # lint:ignore:params_empty_string_assignment
String $client_options = 'auto',
) {
$real_mountpoint = $mountpoint ? {
'' => $name,
default => $mountpoint
}
mount { "shared ${share} by ${server}":
device => "${server}:${share}",
fstype => 'nfs',
name => $real_mountpoint,
options => $client_options,
remounts => false,
atboot => true,
}
case $ensure {
'present': {
exec { "create ${real_mountpoint} and parents":
command => "mkdir -p ${real_mountpoint}",
unless => "test -d ${real_mountpoint}",
path => '/bin:/usr/bin:/usr/local/bin',
}
Mount["shared ${share} by ${server}"] {
require => [Exec["create ${real_mountpoint} and parents"]],
ensure => mounted,
}
}
'absent': {
Mount["shared ${share} by ${server}"] {
ensure => unmounted,
}
}
default: {}
}
}
|