nfs: Merge from parameterize branch
This commit is contained in:
parent
f619236878
commit
bd5ccf4211
3 changed files with 100 additions and 28 deletions
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
# Install NFS client.
|
# Install NFS client.
|
||||||
#
|
#
|
||||||
class nfs::client {
|
class nfs::client {
|
||||||
|
@ -13,12 +12,31 @@ class nfs::client {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if $::operatingsystem == "Fedora" and $::operatingsystemrelease >= 16 {
|
case $::operatingsystem {
|
||||||
# https://bugzilla.redhat.com/show_bug.cgi?id=692008
|
"fedora": {
|
||||||
service { "NetworkManager-wait-online":
|
# https://bugzilla.redhat.com/show_bug.cgi?id=692008
|
||||||
ensure => stopped,
|
service { "NetworkManager-wait-online":
|
||||||
enable => true,
|
ensure => stopped,
|
||||||
|
enable => true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
"ubuntu": {
|
||||||
|
file { "/etc/modprobe.d/lockd.conf":
|
||||||
|
ensure => present,
|
||||||
|
mode => "0644",
|
||||||
|
owner => "root",
|
||||||
|
group => "root",
|
||||||
|
content => "options lockd nlm_tcpport=4001 nlm_udpport=4001\n",
|
||||||
|
before => Package["nfs-utils"],
|
||||||
|
}
|
||||||
|
augeas { "set-nfs-common":
|
||||||
|
context => "/files/etc/default/nfs-common",
|
||||||
|
changes => "set STATDOPTS '\"--port 4000\"'",
|
||||||
|
notify => Service["nfslock"],
|
||||||
|
require => Package["nfs-utils"],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default: { }
|
||||||
}
|
}
|
||||||
|
|
||||||
service { "nfslock":
|
service { "nfslock":
|
||||||
|
@ -26,8 +44,8 @@ class nfs::client {
|
||||||
enable => true,
|
enable => true,
|
||||||
name => $::operatingsystem ? {
|
name => $::operatingsystem ? {
|
||||||
"centos" => $::operatingsystemrelease ? {
|
"centos" => $::operatingsystemrelease ? {
|
||||||
/^[1-6]/ => "nfslock",
|
/^[1-6]/ => "nfslock",
|
||||||
default => "rpc-statd",
|
default => "rpc-statd",
|
||||||
},
|
},
|
||||||
"fedora" => $::operatingsystemrelease ? {
|
"fedora" => $::operatingsystemrelease ? {
|
||||||
/^([1-9]|1[0-5])$/ => "nfslock",
|
/^([1-9]|1[0-5])$/ => "nfslock",
|
||||||
|
@ -45,30 +63,62 @@ class nfs::client {
|
||||||
|
|
||||||
# Install and configure NFS server.
|
# Install and configure NFS server.
|
||||||
#
|
#
|
||||||
class nfs::server {
|
# === Parameters
|
||||||
|
#
|
||||||
|
# $servers:
|
||||||
|
# Number of nfs server processes to be started. Defaults to 8.
|
||||||
|
#
|
||||||
|
# $versions:
|
||||||
|
# Array of NFS versions to enable. Defaults to [ "3" ].
|
||||||
|
#
|
||||||
|
class nfs::server(
|
||||||
|
$servers="8",
|
||||||
|
$versions=["3"],
|
||||||
|
) {
|
||||||
|
|
||||||
|
$default_versions = [ "2", "3", "4" ]
|
||||||
|
$disable_versions = inline_template('<%= (@default_versions - @versions).map { |v| "-N %s" % v }.join(" ") %>')
|
||||||
|
|
||||||
require nfs::client
|
require nfs::client
|
||||||
|
|
||||||
file { "/etc/exports":
|
file { "/etc/exports":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
source => [
|
source => [
|
||||||
"puppet:///files/nfs/exports.${::homename}",
|
"puppet:///files/nfs/exports.${::homename}",
|
||||||
"puppet:///modules/nfs/exports",
|
"puppet:///modules/nfs/exports",
|
||||||
],
|
],
|
||||||
mode => "0644",
|
mode => "0644",
|
||||||
owner => "root",
|
owner => "root",
|
||||||
group => "root",
|
group => "root",
|
||||||
require => Package["nfs-utils"],
|
notify => Exec["exportfs"],
|
||||||
notify => Exec["exportfs"],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/etc/sysconfig/nfs":
|
case $::operatingsystem {
|
||||||
ensure => present,
|
"centos","redhat","fedora": {
|
||||||
content => template("nfs/nfs.sysconfig.erb"),
|
file { "/etc/sysconfig/nfs":
|
||||||
mode => "0644",
|
ensure => present,
|
||||||
owner => "root",
|
mode => "0644",
|
||||||
group => "root",
|
owner => "root",
|
||||||
notify => Service["nfs"],
|
group => "root",
|
||||||
|
content => template("nfs/nfs.sysconfig.erb"),
|
||||||
|
notify => Service["nfs"],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"ubuntu": {
|
||||||
|
package { "nfs-kernel-server":
|
||||||
|
ensure => installed,
|
||||||
|
}
|
||||||
|
file { "/etc/default/nfs-kernel-server":
|
||||||
|
ensure => present,
|
||||||
|
mode => "0644",
|
||||||
|
owner => "root",
|
||||||
|
group => "root",
|
||||||
|
content => template("nfs/nfs-kernel-server.erb"),
|
||||||
|
require => Package["nfs-kernel-server"],
|
||||||
|
notify => Service["nfs"],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default: { }
|
||||||
}
|
}
|
||||||
|
|
||||||
service { "nfs":
|
service { "nfs":
|
||||||
|
@ -78,11 +128,11 @@ class nfs::server {
|
||||||
/^([1-9]|1[0-5])$/ => "nfs",
|
/^([1-9]|1[0-5])$/ => "nfs",
|
||||||
default => "nfs-server",
|
default => "nfs-server",
|
||||||
},
|
},
|
||||||
|
"ubuntu" => "nfs-kernel-server",
|
||||||
default => "nfs",
|
default => "nfs",
|
||||||
},
|
},
|
||||||
enable => true,
|
enable => true,
|
||||||
hasstatus => true,
|
hasstatus => true,
|
||||||
require => Service["nfslock"],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exec { "exportfs":
|
exec { "exportfs":
|
||||||
|
|
22
nfs/templates/nfs-kernel-server.erb
Normal file
22
nfs/templates/nfs-kernel-server.erb
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# Number of servers to start up
|
||||||
|
RPCNFSDCOUNT=<%= @servers %>
|
||||||
|
|
||||||
|
# Runtime priority of server (see nice(1))
|
||||||
|
RPCNFSDPRIORITY=0
|
||||||
|
|
||||||
|
# Options for rpc.mountd.
|
||||||
|
# If you have a port-based firewall, you might want to set up
|
||||||
|
# a fixed port here using the --port option. For more information,
|
||||||
|
# see rpc.mountd(8) or http://wiki.debian.org/SecuringNFS
|
||||||
|
# To disable NFSv4 on the server, specify '--no-nfs-version 4' here
|
||||||
|
RPCMOUNTDOPTS="--manage-gids --port 4002 <%= @disable_versions %>"
|
||||||
|
|
||||||
|
# Do you want to start the svcgssd daemon? It is only required for Kerberos
|
||||||
|
# exports. Valid alternatives are "yes" and "no"; the default is "no".
|
||||||
|
NEED_SVCGSSD=""
|
||||||
|
|
||||||
|
# Options for rpc.svcgssd.
|
||||||
|
RPCSVCGSSDOPTS=""
|
||||||
|
|
||||||
|
# Options for rpc.nfsd.
|
||||||
|
RPCNFSDOPTS="<%= @disable_versions %>"
|
|
@ -26,20 +26,20 @@ LOCKD_UDPPORT=4001
|
||||||
# Turn off v2 and v3 protocol support
|
# Turn off v2 and v3 protocol support
|
||||||
#RPCNFSDARGS="-N 2 -N 3"
|
#RPCNFSDARGS="-N 2 -N 3"
|
||||||
# Turn off v4 protocol support
|
# Turn off v4 protocol support
|
||||||
RPCNFSDARGS="-N 4"
|
RPCNFSDARGS="<%= @disable_versions %>"
|
||||||
# Number of nfs server processes to be started.
|
# Number of nfs server processes to be started.
|
||||||
# The default is 8.
|
# The default is 8.
|
||||||
RPCNFSDCOUNT=64
|
RPCNFSDCOUNT=<%= @servers %>
|
||||||
# Stop the nfsd module from being pre-loaded
|
# Stop the nfsd module from being pre-loaded
|
||||||
#NFSD_MODULE="noload"
|
#NFSD_MODULE="noload"
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
<% if @operatingsystem == 'Fedora' -%>
|
<% if @operatingsystem == 'Fedora' -%>
|
||||||
# Optional arguments passed to rpc.mountd. See rpc.mountd(8)
|
# Optional arguments passed to rpc.mountd. See rpc.mountd(8)
|
||||||
RPCMOUNTDOPTS="--no-nfs-version 4 -p 4002"
|
RPCMOUNTDOPTS="<%= @disable_versions %> -p 4002"
|
||||||
<% else -%>
|
<% else -%>
|
||||||
# Optional arguments passed to rpc.mountd. See rpc.mountd(8)
|
# Optional arguments passed to rpc.mountd. See rpc.mountd(8)
|
||||||
RPCMOUNTDOPTS="--no-nfs-version 4"
|
RPCMOUNTDOPTS="<%= @disable_versions %>"
|
||||||
# Port rpc.mountd should listen on.
|
# Port rpc.mountd should listen on.
|
||||||
MOUNTD_PORT=4002
|
MOUNTD_PORT=4002
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
Loading…
Add table
Reference in a new issue