forked from voxpupuli/puppet-nfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparams.pp
169 lines (164 loc) · 6.82 KB
/
params.pp
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
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
165
166
167
168
169
# == Class: nfs::params
#
# This class exists to
# 1. Declutter the default value assignment for class parameters.
# 2. Manage internally used module variables in a central place.
#
# Therefore, many operating system dependent differences (names, paths, ...)
# are addressed in here.
#
#
# === Parameters
#
# This class does not provide any parameters.
#
#
# === Examples
#
# This class is not intended to be used directly.
#
#
# === Links
#
# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY]
#
#
# === Authors
#
# * Daniel Klockenkaemper <mailto:[email protected]>
#
class nfs::params {
#### Default values for the parameters of the main module class, init.pp
$nfs_v4 = false
$nfs_v4_export_root = '/export'
$nfs_v4_export_root_clients = "*.${::domain}(ro,fsid=root,insecure,no_subtree_check,async,root_squash)"
$nfs_v4_mount_root = '/srv'
$nfs_v4_idmap_domain = $::domain
# Different path and package definitions
case $::osfamily {
'Debian': {
$exports_file = '/etc/exports'
$idmapd_file = '/etc/idmapd.conf'
$defaults_file = '/etc/default/nfs-common'
$server_packages = [ 'nfs-common', 'nfs-kernel-server', 'nfs4-acl-tools', 'rpcbind' ]
$client_packages = [ 'nfs-common', 'nfs4-acl-tools' ]
}
'RedHat': {
$exports_file = '/etc/exports'
$idmapd_file = '/etc/idmapd.conf'
$defaults_file = '/etc/default/nfs-common'
$server_packages = [ 'nfs-utils', 'nfs4-acl-tools', 'rpcbind' ]
$client_packages = [ 'nfs-utils', 'nfs4-acl-tools', 'rpcbind' ]
}
'Gentoo': {
$exports_file = '/etc/exports'
$idmapd_file = '/etc/idmapd.conf'
$defaults_file = '/etc/conf.d/nfs'
$server_packages = ['net-nds/rpcbind', 'net-fs/nfs-utils', 'net-libs/libnfsidmap']
$client_packages = ['net-nds/rpcbind', 'net-fs/nfs-utils', 'net-libs/libnfsidmap']
}
'Suse': {
$exports_file = '/etc/exports'
$idmapd_file = '/etc/idmapd.conf'
$server_packages = ['nfs-kernel-server']
$client_packages = ['nfsidmap', 'nfs-client', 'rpcbind']
$defaults_file = undef
}
'Archlinux': {
$exports_file = '/etc/exports'
$idmapd_file = '/etc/idmapd.conf'
$server_packages = ['nfs-utils']
$client_packages = ['nfsidmap', 'rpcbind']
$defaults_file = undef
}
default: {
$exports_file = undef
$idmapd_file = undef
$defaults_file = undef
$server_packages = undef
$client_packages = undef
notice("\"${module_name}\" provides no config directory and package default values for OS family \"${::osfamily}\"")
}
}
# service parameters
# params that are the same on all (known) OSes.
$client_nfs_fstype = 'nfs'
$client_services_hasrestart = true
$client_services_hasstatus = true
$server_service_hasrestart = true
$server_service_hasstatus = true
#params with OS-specific values
case "${::osfamily}-${::operatingsystemmajrelease}" {
/^Debian/: {
$client_idmapd_setting = [ 'set NEED_IDMAPD yes' ]
$client_nfs_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,nfsvers=3,actimeo=3'
$client_services = { 'rpcbind' => {} }
$client_nfsv4_fstype = 'nfs4'
$client_nfsv4_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3'
$client_nfsv4_services = { 'rpcbind' => {}, 'idmapd' => {} }
$server_nfsv4_servicehelper = 'idmapd'
$server_service_name = 'nfs-kernel-server'
}
'RedHat-7': {
$client_idmapd_setting = [ '' ]
$client_nfs_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3'
$client_services = { 'rpcbind.service' => {} }
$client_nfsv4_fstype = 'nfs4'
$client_nfsv4_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3'
$client_nfsv4_services = { 'rpcbind.service' => {} }
$server_nfsv4_servicehelper = 'nfs-idmap.service'
$server_service_name = 'nfs-server.service'
}
/^RedHat/: {
$client_idmapd_setting = [ '' ]
$client_nfs_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3'
$client_services = { 'rpcbind' => {} }
$client_nfsv4_fstype = 'nfs4'
$client_nfsv4_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3'
$client_nfsv4_services = { 'rpcbind' => {}, 'rpcidmapd' => {} }
$server_nfsv4_servicehelper = 'rpcidmapd'
$server_service_name = 'nfs'
}
/^Gentoo/: {
$client_idmapd_setting = [ 'set NFS_NEEDED_SERVICES rpc.idmapd' ]
$client_nfs_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,nfsvers=3,actimeo=3'
$client_services = { 'rpcbind' => {} }
$client_nfsv4_fstype = 'nfs4'
$client_nfsv4_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,nfsvers=4,actimeo=3'
$client_nfsv4_services = { 'rpcbind' => {}, 'rpc.idmapd' => {} }
$server_nfsv4_servicehelper = 'rpc.idmapd'
$server_service_name = 'nfs'
}
/^Suse/: {
$client_idmapd_setting = [ '' ]
$client_nfs_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,nfsvers=3,actimeo=3'
$client_services = { 'rpcbind' => { before => Service['nfs'] }, 'nfs' => {} }
$client_nfsv4_fstype = 'nfs4'
$client_nfsv4_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,nfsvers=4,actimeo=3'
$client_nfsv4_services = { 'rpcbind' => { before => Service['nfs'] }, 'nfs' => {} }
$server_nfsv4_servicehelper = undef
$server_service_name = 'nfsserver'
}
/^Archlinux/: {
$client_idmapd_setting = [ '' ]
$client_nfs_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,nfsvers=3,actimeo=3'
$client_services = { 'rpcbind' => {} }
$client_nfsv4_fstype = 'nfs4'
$client_nfsv4_options = 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,nfsvers=4,actimeo=3'
$client_nfsv4_services = { 'rpcbind' => {}, 'rpc.idmapd' => {} }
$server_nfsv4_servicehelper = 'rpc.idmapd'
$server_service_name = 'nfs-server.service'
}
default: {
# need to explicitly set unknown params to undef to work with strict_variables=true
$client_idmapd_setting = undef
$client_nfs_options = undef
$client_nfsv4_fstype = undef
$client_nfsv4_options = undef
$client_nfsv4_services = undef
$server_nfsv4_servicehelper = undef
$server_service_name = undef
notice("\"${module_name}\" provides no service parameters for OS family \"${::osfamily}\"")
}
}
}