-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
339 additions
and
452 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,32 @@ | ||
# == Class: nfs::client | ||
# Class: nfs::client | ||
# | ||
# @summary | ||
# This class exists to | ||
# 1. order the loading of classes | ||
# 2. including all needed classes for nfs as a client | ||
# | ||
# | ||
# === Links | ||
# | ||
# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] | ||
# | ||
# | ||
# === Authors | ||
# | ||
# @param ensure | ||
# The ensure parameter is used to determine if the nfs client should be configured | ||
# and running or not. Valid values are 'present' and 'absent'. Default is 'present'. | ||
# @param nfs_v4 | ||
# The nfs_v4 parameter is used to determine if the nfs client should use nfs version 4. | ||
# Valid values are 'true' and 'false'. Default is 'false'. | ||
# @param nfs_v4_mount_root | ||
# The nfs_v4_mount_root parameter is used to determine the root directory for nfs version 4 mounts. | ||
# Default is '/mnt'. | ||
# @param nfs_v4_idmap_domain | ||
# The nfs_v4_idmap_domain parameter is used to determine the domain for nfs version 4 id mapping. | ||
# Default is 'localdomain'. | ||
# @authors | ||
# * Daniel Klockenkaemper <mailto:[email protected]> | ||
# * Martin Alfke <[email protected]> | ||
# | ||
|
||
class nfs::client ( | ||
$ensure = $nfs::ensure, | ||
$nfs_v4 = $nfs::nfs_v4_client, | ||
$nfs_v4_mount_root = $nfs::nfs_v4_mount_root, | ||
$nfs_v4_idmap_domain = $nfs::nfs_v4_idmap_domain, | ||
String $ensure = $nfs::ensure, | ||
String $nfs_v4 = $nfs::nfs_v4_client, | ||
String $nfs_v4_mount_root = $nfs::nfs_v4_mount_root, | ||
String $nfs_v4_idmap_domain = $nfs::nfs_v4_idmap_domain, | ||
) { | ||
anchor { 'nfs::client::begin': } | ||
anchor { 'nfs::client::end': } | ||
|
||
# package(s) | ||
class { 'nfs::client::package': } | ||
|
||
|
@@ -35,18 +38,12 @@ | |
|
||
if $ensure == 'present' { | ||
# we need the software before configuring it | ||
Anchor['nfs::client::begin'] | ||
-> Class['nfs::client::package'] | ||
Class['nfs::client::package'] | ||
-> Class['nfs::client::config'] | ||
# we need the software and a working configuration before running a service | ||
Class['nfs::client::package'] -> Class['nfs::client::service'] | ||
Class['nfs::client::config'] -> Class['nfs::client::service'] | ||
Class['nfs::client::service'] -> Anchor['nfs::client::end'] | ||
-> Class['nfs::client::service'] | ||
} else { | ||
# make sure all services are getting stopped before software removal | ||
Anchor['nfs::client::begin'] | ||
-> Class['nfs::client::service'] | ||
Class['nfs::client::service'] | ||
-> Class['nfs::client::package'] | ||
-> Anchor['nfs::client::end'] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,12 @@ | ||
# == Class: nfs::client::config | ||
# | ||
# Class: nfs::client::config | ||
# @summary | ||
# This Function exists to | ||
# 1. configure nfs as a client | ||
# | ||
# | ||
# === Links | ||
# | ||
# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] | ||
# | ||
# | ||
# === Authors | ||
# | ||
# @authors | ||
# * Daniel Klockenkaemper <mailto:[email protected]> | ||
# * Martin Alfke <[email protected]> | ||
# | ||
|
||
class nfs::client::config { | ||
if $nfs::client::nfs_v4 { | ||
if $nfs::defaults_file != undef { | ||
|
@@ -46,14 +39,18 @@ | |
|
||
if $nfs::client_d9_gssdopt_workaround and $nfs::client_gssd_service { | ||
file_line { 'rpc-gssd.service': | ||
path => '/lib/systemd/system/rpc-gssd.service', | ||
match => 'EnvironmentFile', | ||
line => 'EnvironmentFile=-/etc/default/nfs-common', | ||
require => Package['nfs-common'], | ||
} ~> exec { 'systemctl daemon-reload': | ||
path => '/lib/systemd/system/rpc-gssd.service', | ||
match => 'EnvironmentFile', | ||
line => 'EnvironmentFile=-/etc/default/nfs-common', | ||
} | ||
exec { 'systemctl daemon-reload': | ||
refreshonly => true, | ||
path => '/bin', | ||
} ~> Service['rpc-gssd'] | ||
} | ||
Package['nfs-common'] | ||
-> File_line['rpc-gssd.service'] | ||
~> Exec['systemctl daemon-reload'] | ||
~> Service['rpc-gssd'] | ||
} | ||
|
||
if ( $nfs::server_enabled == false ) or ( $nfs::server_enabled == true and $nfs::nfs_v4 == false ) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,60 @@ | ||
# == Function: nfs::client::mount | ||
# Function: nfs::client::mount | ||
# | ||
# @summary | ||
# This Function exists to | ||
# 1. manage all mounts on a nfs client | ||
# | ||
# === Parameters | ||
# Parameters | ||
# | ||
# [*server*] | ||
# @param server | ||
# String. Sets the ip address of the server with the nfs export | ||
# | ||
# [*share*] | ||
# @param share | ||
# String. Sets the name of the nfs share on the server | ||
# | ||
# [*ensure*] | ||
# @param ensure | ||
# String. Sets the ensure parameter of the mount. | ||
# | ||
# [*remounts*] | ||
# @param remounts | ||
# String. Sets the remounts parameter of the mount. | ||
# | ||
# [*atboot*] | ||
# @param atboot | ||
# String. Sets the atboot parameter of the mount. | ||
# | ||
# [*options_nfsv4*] | ||
# @param options_nfsv4 | ||
# String. Sets the mount options for a nfs version 4 mount. | ||
# | ||
# [*options_nfs*] | ||
# @param options_nfs | ||
# String. Sets the mount options for a nfs mount. | ||
# | ||
# [*bindmount*] | ||
# @param bindmount | ||
# String. When not undef it will create a bindmount on the node | ||
# for the nfs mount. | ||
# | ||
# [*nfstag*] | ||
# @param nfstag | ||
# String. Sets the nfstag parameter of the mount. | ||
# | ||
# [*nfs_v4*] | ||
# param nfs_v4 | ||
# Boolean. When set to true, it uses nfs version 4 to mount a share. | ||
# | ||
# [*owner*] | ||
# @param owner | ||
# String. Set owner of mount dir | ||
# | ||
# [*group*] | ||
# @param group | ||
# String. Set group of mount dir | ||
# | ||
# [*mode*] | ||
# @param mode | ||
# String. Set mode of mount dir | ||
# | ||
# [*mount_root*] | ||
# @param mount_root | ||
# String. Overwrite mount root if differs from server config | ||
# | ||
|
||
# === Examples | ||
# @param mount | ||
# @param manage_packages | ||
# @param client_packages | ||
# @param nfs_v4 | ||
# | ||
# @examples | ||
# | ||
# class { '::nfs': | ||
# client_enabled => true, | ||
|
@@ -64,29 +69,28 @@ | |
# options_nfsv4 => 'tcp,nolock,rsize=32768,wsize=32768,intr,noatime,actimeo=3' | ||
# } | ||
# | ||
# === Authors | ||
# | ||
# @authors | ||
# * Daniel Klockenkaemper <mailto:[email protected]> | ||
# * Martin Alfke <[email protected]> | ||
# | ||
|
||
define nfs::client::mount ( | ||
$server, | ||
$share = undef, | ||
$ensure = 'mounted', | ||
$mount = $title, | ||
$remounts = false, | ||
$atboot = false, | ||
$options_nfsv4 = $nfs::client_nfsv4_options, | ||
$options_nfs = $nfs::client_nfs_options, | ||
$bindmount = undef, | ||
$nfstag = undef, | ||
$nfs_v4 = $nfs::client::nfs_v4, | ||
$owner = undef, | ||
$group = undef, | ||
$mode = undef, | ||
$mount_root = undef, | ||
$manage_packages = $nfs::manage_packages, | ||
$client_packages = $nfs::effective_client_packages, | ||
String[1] $server, | ||
Optional[String[1]] $share = undef, | ||
String[1] $ensure = 'mounted', | ||
String[1] $mount = $title, | ||
Boolean $remounts = false, | ||
Boolean $atboot = false, | ||
String[1] $options_nfsv4 = $nfs::client_nfsv4_options, | ||
String[1] $options_nfs = $nfs::client_nfs_options, | ||
Optional[String[1]] $bindmount = undef, | ||
Optional[String[1]] $nfstag = undef, | ||
Boolean $nfs_v4 = $nfs::client::nfs_v4, | ||
Optional[String[1]] $owner = undef, | ||
Optional[String[1]] $group = undef, | ||
Optional[String[1]] $mode = undef, | ||
Optional[String[1]] $mount_root = undef, | ||
Boolean $manage_packages = $nfs::manage_packages, | ||
Optional[Variant[String[1], Array[String[1]]]] $client_packages = $nfs::effective_client_packages, | ||
) { | ||
if $manage_packages and $client_packages != undef { | ||
$mount_require = [Nfs::Functions::Mkdir[$mount], Package[$client_packages]] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,13 @@ | ||
# == Class: nfs::client::package | ||
# Class: nfs::client::package | ||
# | ||
# @summary | ||
# This Function exists to | ||
# 1. install needed packages for nfs clients | ||
# | ||
# | ||
# === Links | ||
# | ||
# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] | ||
# | ||
# | ||
# === Authors | ||
# | ||
# @authors | ||
# * Daniel Klockenkaemper <mailto:[email protected]> | ||
# * Martin Alfke <[email protected]> | ||
# | ||
|
||
class nfs::client::package { | ||
if $nfs::manage_packages { | ||
if $nfs::client::nfs_v4 { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,13 @@ | ||
# == Class: nfs::client::service | ||
# Class: nfs::client::service | ||
# | ||
# @summary | ||
# This Function exists to | ||
# 1. manage the needed services for nfs clients | ||
# | ||
# | ||
# === Links | ||
# | ||
# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] | ||
# | ||
# | ||
# === Authors | ||
# | ||
# @authors | ||
# * Daniel Klockenkaemper <mailto:[email protected]> | ||
# * Martin Alfke <[email protected]> | ||
# | ||
|
||
class nfs::client::service { | ||
if $nfs::client::nfs_v4 { | ||
$create_services = $nfs::effective_nfsv4_client_services | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,22 @@ | ||
# == Function: nfs::functions::bindmount | ||
# Function: nfs::functions::bindmount | ||
# | ||
# @summary | ||
# This Function exists to | ||
# 1. manage bindmounts | ||
# | ||
# === Parameters | ||
# | ||
# [*mount_name*] | ||
# @param mount_name | ||
# String. Sets the target directory for the bindmount | ||
# | ||
# [*ensure*] | ||
# @param ensure | ||
# String. Sets if enabled or not. | ||
# | ||
# === Examples | ||
# | ||
# This Function should not be called directly. | ||
# | ||
# === Links | ||
# | ||
# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] | ||
# | ||
# | ||
# === Authors | ||
# | ||
# @authors | ||
# * Daniel Klockenkaemper <mailto:[email protected]> | ||
# * Martin Alfke <[email protected]> | ||
# | ||
|
||
define nfs::functions::bindmount ( | ||
$mount_name = undef, | ||
$ensure = 'present', | ||
Optional[String[1]] $mount_name = undef, | ||
String[1] $ensure = 'present', | ||
) { | ||
nfs::functions::mkdir { $mount_name: | ||
ensure => $ensure, | ||
|
Oops, something went wrong.