diff --git a/.fixtures.yml b/.fixtures.yml index 73c6493..75366ce 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -6,10 +6,8 @@ fixtures: augeasproviders_shellvar: "https://github.com/voxpupuli/puppet-augeasproviders_shellvar.git" augeas_core: repo: "https://github.com/puppetlabs/puppetlabs-augeas_core.git" - puppet_version: ">= 6.0.0" mount_core: repo: "https://github.com/puppetlabs/puppetlabs-mount_core.git" - puppet_version: ">= 6.0.0" transition: "https://github.com/puppetlabs/puppetlabs-transition.git" symlinks: "nfs": "#{source_dir}" diff --git a/manifests/client.pp b/manifests/client.pp index e171d75..b49a4b8 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -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 +# * Martin Alfke # - 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'] } } diff --git a/manifests/client/config.pp b/manifests/client/config.pp index 6c4e92b..94ad2fe 100644 --- a/manifests/client/config.pp +++ b/manifests/client/config.pp @@ -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 +# * Martin Alfke # - 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 ) { diff --git a/manifests/client/mount.pp b/manifests/client/mount.pp index 9101abf..8f4142e 100644 --- a/manifests/client/mount.pp +++ b/manifests/client/mount.pp @@ -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 +# * Martin Alfke # - 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]] diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 1a01b27..5b6aa44 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -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 +# * Martin Alfke # - class nfs::client::package { if $nfs::manage_packages { if $nfs::client::nfs_v4 { diff --git a/manifests/client/service.pp b/manifests/client/service.pp index 0a9a5b3..613684f 100644 --- a/manifests/client/service.pp +++ b/manifests/client/service.pp @@ -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 +# * Martin Alfke # - class nfs::client::service { if $nfs::client::nfs_v4 { $create_services = $nfs::effective_nfsv4_client_services diff --git a/manifests/functions/bindmount.pp b/manifests/functions/bindmount.pp index a309ddd..455aa3b 100644 --- a/manifests/functions/bindmount.pp +++ b/manifests/functions/bindmount.pp @@ -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 +# * Martin Alfke # - 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, diff --git a/manifests/functions/create_export.pp b/manifests/functions/create_export.pp index f3f42ff..ff74b26 100644 --- a/manifests/functions/create_export.pp +++ b/manifests/functions/create_export.pp @@ -1,45 +1,34 @@ -# == Function: nfs::functions::create_export +# Function: nfs::functions::create_export # +# @summary # This Function exists to # 1. manage export creation # -# === Parameters -# -# [*clients*] +# @param clients # String or Array. Sets the clients allowed to mount the export with options. # -# [*ensure*] +# @param ensure # String. Sets if enabled or not. # -# [*owner*] +# @param owner # String. Sets the owner of the exported directory. # -# [*group*] +# @param group # String. Sets the group of the exported directory. # -# [*mode*] +# @param mode # String. Sets the permissions of the exported directory. # -# === Examples -# -# This Function should not be called directly. -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# -# === Authors -# +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - define nfs::functions::create_export ( - $clients, - $ensure = 'present', - $owner = undef, - $group = undef, - $mode = undef, + Variant[String[1], Array[String[1]]] $clients, + String[1] $ensure = 'present', + Optional[String[1]] $owner = undef, + Optional[String[1]] $group = undef, + Optional[String[1]] $mode = undef, ) { if $ensure != 'absent' { $line = "${name} ${join(any2array($clients),' ')}\n" diff --git a/manifests/functions/mkdir.pp b/manifests/functions/mkdir.pp index 9fe1684..fe0a6a6 100644 --- a/manifests/functions/mkdir.pp +++ b/manifests/functions/mkdir.pp @@ -1,28 +1,17 @@ -# == Function: nfs::functions::mkdir +# Function: nfs::functions::mkdir # +# @summary # This Function exists to # 1. manage dir creation # -# === Parameters -# -# None -# -# === Examples -# -# This Function should not be called directly. -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# -# === Authors +# @param ensure # +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - define nfs::functions::mkdir ( - $ensure = 'present', + String[1] $ensure = 'present', ) { if $ensure != 'absent' { exec { "mkdir_recurse_${name}": diff --git a/manifests/functions/nfsv4_bindmount.pp b/manifests/functions/nfsv4_bindmount.pp index 104386f..0934d2f 100644 --- a/manifests/functions/nfsv4_bindmount.pp +++ b/manifests/functions/nfsv4_bindmount.pp @@ -1,37 +1,27 @@ -# == Function: nfs::functions::nfsv4_bindmount +# Function: nfs::functions::nfsv4_bindmount # +# @summary # This Function exists to # 1. manage bindmounts for nfs4 # -# === Parameters -# -# [*v4_export_name*] +# @param v4_export_name # String. Sets the target directory for the bindmount # -# [*bind*] +# @param bind # String. Sets the bindmount options. # -# [*ensure*] +# @param ensure # String. Sets if mounted or not. # -# === Examples -# -# This Function should not be called directly. -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# # === Authors # # * Daniel Klockenkaemper # define nfs::functions::nfsv4_bindmount ( - $v4_export_name, - $bind, - $ensure = 'mounted', + String[1] $v4_export_name, + String[1] $bind, + String[1] $ensure = 'mounted', ) { $normalize_export_root = regsubst($nfs::server::nfs_v4_export_root, '/$', '') $expdir = "${normalize_export_root}/${v4_export_name}" diff --git a/manifests/init.pp b/manifests/init.pp index b5a62b3..b0e5074 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,9 +1,6 @@ -# == Class: nfs::init +# Class: nfs::init # -# This class exists to -# === Parameters -# -# [*ensure*] +# @param ensure # String. Controls if the managed resources shall be present or # absent. If set to absent: # * The managed software packages are being uninstalled. @@ -16,260 +13,218 @@ # (e.g. removal of created users, services, changed log settings, ...). # * This is thus destructive and should be used with care. # Defaults to present. -# -# [*server_enabled*] +# @param server_enabled # Boolean. If set to true, this module will configure the node # to act as a nfs server. -# -# [*client_enabled*] +# @param client_enabled # Boolean. If set to true, this module will configure the node # to act as a client server, you can use the exported mount resources # from configured servers. -# -# [*storeconfigs_enabled*] +# @param storeconfigs_enabled # Boolean. If set to false, this module will not export any # resources as storeconfigs. Defaults to true. -# -# [*nfs_v4*] +# @param nfs_v4 # Boolean. If set to true, this module will use nfs version 4 # for exporting and mounting nfs resources. -# -# [*nfs_v4_client*] +# @param nfs_v4_client # Boolean. If set to true, this module will use nfs version 4 # for mounting nfs resources. If set to false it will use nfs -# version 3 to mount nfs resources. It defaults to the setting of [*nfs_v4*] -# -# [*exports_file*] +# version 3 to mount nfs resources. It defaults to the setting of @param nfs_v4 +# @param exports_file # String. It defines the location of file with the nfs export resources used # by the nfs server. -# -# [*idmapd_file*] +# @param idmapd_file # String. It defines the location of the file with the idmapd settings. -# -# [*defaults_file*] +# @param defaults_file # String. It defines the location of the file with the nfs settings. -# -# [*manage_packages*] +# @param manage_packages # Boolean. It defines if the packages should be managed through this module -# -# [*server_packages*] +# @param server_packages # Array. It defines the packages needed to be installed for acting as # a nfs server -# -# [*server_package_ensure*] +# @param server_package_ensure # String. It defines the packages state - any of present, installed, # absent, purged, held, latest -# -# [*client_packages*] +# @param client_packages # Array. It defines the packages needed to be installed for acting as # a nfs client -# -# [*client_package_ensure*] +# @param client_package_ensure # String. It defines the packages state - any of present, installed, # absent, purged, held, latest -# -# [*manage_server_service*] +# @param manage_server_service # Boolean. Defines if module should manage server_service -# -# [*manage_server_servicehelper*] +# @param manage_server_servicehelper # Boolean. Defines if module should manage server_servicehelper -# -# [*manage_client_service*] +# @param manage_client_service # Boolean. Defines if module should manage client_service -# -# [*server_service_name*] +# @param server_service_name # String. It defines the servicename of the nfs server service -# -# [*server_service_ensure*] +# @param server_service_ensure # Boolean. It defines the service parameter ensure for nfs server services. -# -# [*server_service_enable*] +# @param server_service_enable # Boolean. It defines the service parameter enable for nfs server service. -# -# [*server_service_hasrestart*] +# @param server_service_hasrestart # Boolean. It defines the service parameter hasrestart for nfs server service. -# -# [*server_service_hasstatus*] +# @param server_service_hasstatus # Boolean. It defines the service parameter hasstatus for nfs server service. -# -# [*server_service_restart_cmd*] +# @param server_service_restart_cmd # String. It defines the service parameter restart for nfs server service. -# -# [*server_nfsv4_servicehelper*] +# @param server_nfsv4_servicehelper # Array. It defines the service helper like idmapd for servers configured with # nfs version 4. -# -# [*client_services*] +# @param client_services # Nested Hash. It defines the servicenames need to be started when acting as a nfs client -# -# [*client_nfsv4_services*] +# @param client_nfsv4_services # Nested Hash. It defines the servicenames need to be started when acting as a nfs client # version 4. -# -# [*client_services_enable*] +# @param client_services_enable # Boolean. It defines the service parameter enable for nfs client services. -# -# [*client_service_hasrestart*] -# Boolean. It defines the service parameter hasrestart for nfs client services. -# -# [*client_service_hasstatus*] -# Boolean. It defines the service parameter hasstatus for nfs client services. -# -# [*client_idmapd_setting*] -# Array. It defines the Augeas parameter added in [*defaults_file*] when acting as a nfs +# @param client_idmapd_setting +# Array. It defines the Augeas parameter added in @param defaults_file when acting as a nfs # version 4 client. -# -# [*client_nfs_fstype*] +# @param client_nfs_fstype # String. It defines the name of the nfs filesystem, when adding entries to /etc/fstab # on a client node. -# -# [*client_nfs_options*] +# @param client_nfs_options # String. It defines the options for the nfs filesystem, when adding entries to /etc/fstab # on a client node. -# -# [*client_nfsv4_fstype*] +# @param client_nfsv4_fstype # String. It defines the name of the nfs version 4 filesystem, when adding entries # to /etc/fstab on a client node. -# -# [*client_nfsv4_options*] +# @param client_nfsv4_options # String. It defines the options for the nfs version 4filesystem, when adding entries # to /etc/fstab on a client node. -# -# [*nfs_v4_export_root*] +# @param nfs_v4_export_root # String. It defines the location where nfs version 4 exports should be bindmounted to # on a server node. Defaults to /export. -# -# [*nfs_v4_export_root_clients*] +# @param nfs_v4_export_root_clients # String. It defines the clients that are allowed to mount nfs version 4 exports and # includes the option string. Defaults to # *.${::domain}(ro,fsid=root,insecure,no_subtree_check,async,root_squash). -# -# [*nfs_v4_mount_root*] +# @param nfs_v4_mount_root # String. It defines the location where nfs version 4 clients find the mount root # on a server node. Defaults to /srv. -# -# [*nfs_v4_idmap_domain*] -# String. It defines the name of the idmapd domain setting in [*idmapd_file*] needed +# @param nfs_v4_idmap_domain +# String. It defines the name of the idmapd domain setting in @param idmapd_file needed # to be set to the same value on a server and client node to do correct uid and gid # mapping. Defaults to $::domain. -# -# [*nfsv4_bindmount_enable*] +# @param nfsv4_bindmount_enable # Boolean. It defines if the module should create a bindmount for the export. # Defaults to true. -# -# [*client_need_gssd*] +# @param client_need_gssd # Boolean. If true, sets NEED_GSSD=yes in /etc/defauls/nfs-common, usable on Debian/Ubuntu -# -# [*client_gssd_service*] +# @param client_gssd_service # Boolean. If true enable rpc-gssd service. -# -# [*client_gssd_options*] +# @param client_gssd_options # String. Options for rpc-gssd service. Defaults to '' -# -# [*client_d9_gssdopt_workaround*] +# @param client_d9_gssdopt_workaround # Boolean. If enabled, workaround for passing gssd_options which is broken on Debian 9. Usable only on Debian 9 -# -# [*nfs_v4_idmap_localrealms*] +# @param nfs_v4_idmap_localrealms # String or Array. 'Local-Realms' option for idmapd. Defaults to '' -# -# [*nfs_v4_idmap_cache*] +# @param nfs_v4_idmap_cache # Integer. 'Cache-Expiration' option for idmapd. Defaults to 0 - unused. -# -# [*manage_nfs_v4_idmap_nobody_mapping*] +# @param manage_nfs_v4_idmap_nobody_mapping # Boolean. Enable setting Nobody mapping in idmapd. Defaults to false. -# -# [*nfs_v4_idmap_nobody_user*] +# @param nfs_v4_idmap_nobody_user # String. 'Nobody-User' option for idmapd. Defaults to nobody. -# -# [*nfs_v4_idmap_nobody_group*] +# @param nfs_v4_idmap_nobody_group # String. 'Nobody-Group' option for idmapd. Defaults to nobody or nogroup. -# -# [*client_rpcbind_config*] +# @param client_rpcbind_config # String. It defines the location of the file with the rpcbind config. -# -# [*client_rpcbind_optname*] +# @param client_rpcbind_optname # String. It defines the name of env variable that holds the rpcbind config. E.g. OPTIONS for Debian -# -# [*client_rpcbind_opts*] +# @param client_rpcbind_opts # String. Options for rpcbind service. +# @param nfs_v4_root_export_ensure +# String. It defines the state of the nfs version 4 root export. Defaults to mounted. +# @param nfs_v4_root_export_mount +# String. It defines the mountpoint of the nfs version 4 root export. Defaults to undef. +# @param nfs_v4_root_export_remounts +# Boolean. It defines if the nfs version 4 root export should be remounted. Defaults to false. +# @param nfs_v4_root_export_atboot +# Boolean. It defines if the nfs version 4 root export should be mounted at boot. Defaults to false. +# @param nfs_v4_root_export_options +# String. It defines the options for the nfs version 4 root export. Defaults to _netdev. +# @param nfs_v4_root_export_bindmount +# String. It defines the bindmount of the nfs version 4 root export. Defaults to undef. +# @param nfs_v4_root_export_tag +# String. It defines the tag of the nfs version 4 root export. Defaults to undef. +# @param client_gssd_service_name +# Hash. It defines the servicename of the rpc-gssd service. +# @param client_services_hasrestart +# Boolean. It defines the service parameter hasrestart for nfs client services. +# @param client_services_hasstatus +# Boolean. It defines the service parameter hasstatus for nfs client services. +# @param client_gssdopt_name +# String. It defines the name of the gssd option in /etc/default/nfs-common. +# @examples +# * {Please take a look at} [https://github.com/voxpupuli/puppet-nfs#examples] # -# -# === Examples -# -# * {Please take a look at} [https://github.com/derdanne/puppet-nfs#examples] -# -# -# === Links -# -# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] -# -# -# === Authors -# +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - class nfs ( - Enum['present', 'absent', 'running', 'stopped', 'disabled'] $ensure = 'present', - Boolean $server_enabled = false, - Boolean $client_enabled = false, - Boolean $storeconfigs_enabled = true, - Boolean $nfs_v4 = $nfs::params::nfs_v4, - Boolean $nfs_v4_client = $nfs::params::nfs_v4, - Stdlib::Absolutepath $exports_file = $nfs::params::exports_file, - Stdlib::Absolutepath $idmapd_file = $nfs::params::idmapd_file, - Optional[Stdlib::Absolutepath] $defaults_file = $nfs::params::defaults_file, - Boolean $manage_packages = true, - Array $server_packages = $nfs::params::server_packages, - String $server_package_ensure = 'installed', - Array $client_packages = $nfs::params::client_packages, - String $client_package_ensure = 'installed', - Boolean $manage_server_service = true, - Boolean $manage_server_servicehelper = true, - Boolean $manage_client_service = true, - String $server_service_name = $nfs::params::server_service_name, - Enum['present', 'absent', 'running', 'stopped', 'disabled'] $server_service_ensure = 'running', - Boolean $server_service_enable = true, - Boolean $server_service_hasrestart = $nfs::params::server_service_hasrestart, - Boolean $server_service_hasstatus = $nfs::params::server_service_hasstatus, - Optional[String] $server_service_restart_cmd = $nfs::params::server_service_restart_cmd, - Optional[Array] $server_nfsv4_servicehelper = $nfs::params::server_nfsv4_servicehelper, - $client_services = $nfs::params::client_services, - $client_nfsv4_services = $nfs::params::client_nfsv4_services, - Boolean $client_services_enable = $nfs::params::client_services_enable, - Boolean $client_services_hasrestart = $nfs::params::client_services_hasrestart, - Boolean $client_services_hasstatus = $nfs::params::client_services_hasstatus, - Array[String] $client_idmapd_setting = $nfs::params::client_idmapd_setting, - String $client_nfs_fstype = $nfs::params::client_nfs_fstype, - String $client_nfs_options = $nfs::params::client_nfs_options, - String $client_nfsv4_fstype = $nfs::params::client_nfsv4_fstype, - String $client_nfsv4_options = $nfs::params::client_nfsv4_options, - Boolean $client_need_gssd = false, - Boolean $client_gssd_service = false, - $client_gssd_service_name = $nfs::params::client_gssd_service_name, - String $client_gssd_options = $nfs::params::client_gssd_options, - String $client_gssdopt_name = $nfs::params::client_gssdopt_name, - Boolean $client_d9_gssdopt_workaround = false, - String $nfs_v4_export_root = $nfs::params::nfs_v4_export_root, - String $nfs_v4_export_root_clients = $nfs::params::nfs_v4_export_root_clients, - String $nfs_v4_mount_root = $nfs::params::nfs_v4_mount_root, - String $nfs_v4_idmap_domain = $nfs::params::nfs_v4_idmap_domain, - Variant[String, Array] $nfs_v4_idmap_localrealms = '', - Integer $nfs_v4_idmap_cache = 0, - Boolean $manage_nfs_v4_idmap_nobody_mapping = false, - String $nfs_v4_idmap_nobody_user = $nfs::params::nfs_v4_idmap_nobody_user, - String $nfs_v4_idmap_nobody_group = $nfs::params::nfs_v4_idmap_nobody_group, - String $nfs_v4_root_export_ensure = 'mounted', - Optional[String] $nfs_v4_root_export_mount = undef, - Boolean $nfs_v4_root_export_remounts = false, - Boolean $nfs_v4_root_export_atboot = false, - String $nfs_v4_root_export_options = '_netdev', - Optional[String] $nfs_v4_root_export_bindmount = undef, - Optional[String] $nfs_v4_root_export_tag = undef, - Boolean $nfsv4_bindmount_enable = true, - Optional[Stdlib::Absolutepath] $client_rpcbind_config = $nfs::params::client_rpcbind_config, - Optional[String] $client_rpcbind_optname = $nfs::params::client_rpcbind_optname, - Optional[String] $client_rpcbind_opts = undef, + Enum['present', 'absent', 'running', 'stopped', 'disabled'] $ensure = 'present', + Boolean $server_enabled = false, + Boolean $client_enabled = false, + Boolean $storeconfigs_enabled = true, + Boolean $nfs_v4 = $nfs::params::nfs_v4, + Boolean $nfs_v4_client = $nfs::params::nfs_v4, + Stdlib::Absolutepath $exports_file = $nfs::params::exports_file, + Stdlib::Absolutepath $idmapd_file = $nfs::params::idmapd_file, + Optional[Stdlib::Absolutepath] $defaults_file = $nfs::params::defaults_file, + Boolean $manage_packages = true, + Array $server_packages = $nfs::params::server_packages, + String $server_package_ensure = 'installed', + Array $client_packages = $nfs::params::client_packages, + String $client_package_ensure = 'installed', + Boolean $manage_server_service = true, + Boolean $manage_server_servicehelper = true, + Boolean $manage_client_service = true, + String $server_service_name = $nfs::params::server_service_name, + Enum['present', 'absent', 'running', 'stopped', 'disabled'] $server_service_ensure = 'running', + Boolean $server_service_enable = true, + Boolean $server_service_hasrestart = $nfs::params::server_service_hasrestart, + Boolean $server_service_hasstatus = $nfs::params::server_service_hasstatus, + Optional[String] $server_service_restart_cmd = $nfs::params::server_service_restart_cmd, + Optional[Array] $server_nfsv4_servicehelper = $nfs::params::server_nfsv4_servicehelper, + Hash $client_services = $nfs::params::client_services, + Hash $client_nfsv4_services = $nfs::params::client_nfsv4_services, + Boolean $client_services_enable = $nfs::params::client_services_enable, + Boolean $client_services_hasrestart = $nfs::params::client_services_hasrestart, + Boolean $client_services_hasstatus = $nfs::params::client_services_hasstatus, + Array[String] $client_idmapd_setting = $nfs::params::client_idmapd_setting, + String $client_nfs_fstype = $nfs::params::client_nfs_fstype, + String $client_nfs_options = $nfs::params::client_nfs_options, + String $client_nfsv4_fstype = $nfs::params::client_nfsv4_fstype, + String $client_nfsv4_options = $nfs::params::client_nfsv4_options, + Boolean $client_need_gssd = false, + Boolean $client_gssd_service = false, + Optional[Hash] $client_gssd_service_name = $nfs::params::client_gssd_service_name, + String $client_gssd_options = $nfs::params::client_gssd_options, + String $client_gssdopt_name = $nfs::params::client_gssdopt_name, + Boolean $client_d9_gssdopt_workaround = false, + String $nfs_v4_export_root = $nfs::params::nfs_v4_export_root, + String $nfs_v4_export_root_clients = $nfs::params::nfs_v4_export_root_clients, + String $nfs_v4_mount_root = $nfs::params::nfs_v4_mount_root, + String $nfs_v4_idmap_domain = $nfs::params::nfs_v4_idmap_domain, + Variant[String, Array] $nfs_v4_idmap_localrealms = '', # lint:ignore:params_empty_string_assignment + Integer $nfs_v4_idmap_cache = 0, + Boolean $manage_nfs_v4_idmap_nobody_mapping = false, + String $nfs_v4_idmap_nobody_user = $nfs::params::nfs_v4_idmap_nobody_user, + String $nfs_v4_idmap_nobody_group = $nfs::params::nfs_v4_idmap_nobody_group, + String $nfs_v4_root_export_ensure = 'mounted', + Optional[String] $nfs_v4_root_export_mount = undef, + Boolean $nfs_v4_root_export_remounts = false, + Boolean $nfs_v4_root_export_atboot = false, + String $nfs_v4_root_export_options = '_netdev', + Optional[String] $nfs_v4_root_export_bindmount = undef, + Optional[String] $nfs_v4_root_export_tag = undef, + Boolean $nfsv4_bindmount_enable = true, + Optional[Stdlib::Absolutepath] $client_rpcbind_config = $nfs::params::client_rpcbind_config, + Optional[String] $client_rpcbind_optname = $nfs::params::client_rpcbind_optname, + Optional[String] $client_rpcbind_opts = undef, ) inherits nfs::params { if $server_enabled { if $server_nfsv4_servicehelper != undef { diff --git a/manifests/params.pp b/manifests/params.pp index 646559f..4ba905f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,5 +1,6 @@ -# == Class: nfs::params +# Class: nfs::params # +# @summary # This class exists to # 1. Declutter the default value assignment for class parameters. # 2. Manage internally used module variables in a central place. @@ -7,27 +8,10 @@ # 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 -# +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - class nfs::params { #### Default values for the parameters of the main module class, init.pp diff --git a/manifests/server.pp b/manifests/server.pp index 68c0b5b..29517f4 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -1,36 +1,44 @@ -# == Class: nfs::server +# @summary Class: nfs::server # # This class exists to # 1. order the loading of classes # 2. including all needed classes for nfs as a server # -# === Links +# Links # # * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] # +# @param ensure +# @param nfs_v4 +# @param nfs_v4_export_root +# @param nfs_v4_export_root_clients +# @param nfs_v4_idmap_domain +# @param nfs_v4_root_export_ensure +# @param nfs_v4_root_export_mount +# @param nfs_v4_root_export_remounts +# @param nfs_v4_root_export_atboot +# @param nfs_v4_root_export_options +# @param nfs_v4_root_export_bindmount +# @param nfs_v4_root_export_tag # -# === Authors -# +# @authors # * Daniel Klockenkaemper +# * Martin Alfke # - class nfs::server ( - $ensure = $nfs::ensure, - $nfs_v4 = $nfs::nfs_v4, - $nfs_v4_export_root = $nfs::nfs_v4_export_root, - $nfs_v4_export_root_clients = $nfs::nfs_v4_export_root_clients, - $nfs_v4_idmap_domain = $nfs::nfs_v4_idmap_domain, - $nfs_v4_root_export_ensure = $nfs::nfs_v4_root_export_ensure, - $nfs_v4_root_export_mount = $nfs::nfs_v4_root_export_mount, - $nfs_v4_root_export_remounts = $nfs::nfs_v4_root_export_remounts, - $nfs_v4_root_export_atboot = $nfs::nfs_v4_root_export_atboot , - $nfs_v4_root_export_options = $nfs::nfs_v4_root_export_options, - $nfs_v4_root_export_bindmount = $nfs::nfs_v4_root_export_bindmount, - $nfs_v4_root_export_tag = $nfs::nfs_v4_root_export_tag, + Enum['present', 'absent', 'running', 'stopped', 'disabled'] $ensure = $nfs::ensure, + Boolean $nfs_v4 = $nfs::nfs_v4, + String $nfs_v4_export_root = $nfs::nfs_v4_export_root, + String $nfs_v4_export_root_clients = $nfs::nfs_v4_export_root_clients, + String $nfs_v4_idmap_domain = $nfs::nfs_v4_idmap_domain, + String $nfs_v4_root_export_ensure = $nfs::nfs_v4_root_export_ensure, + Optional[String] $nfs_v4_root_export_mount = $nfs::nfs_v4_root_export_mount, + Boolean $nfs_v4_root_export_remounts = $nfs::nfs_v4_root_export_remounts, + Boolean $nfs_v4_root_export_atboot = $nfs::nfs_v4_root_export_atboot , + String $nfs_v4_root_export_options = $nfs::nfs_v4_root_export_options, + Optional[String] $nfs_v4_root_export_bindmount = $nfs::nfs_v4_root_export_bindmount, + Optional[String] $nfs_v4_root_export_tag = $nfs::nfs_v4_root_export_tag, ) { - anchor { 'nfs::server::begin': } - anchor { 'nfs::server::end': } - # package(s) class { 'nfs::server::package': } @@ -42,18 +50,12 @@ if $ensure == 'present' { # we need the software before configuring it - Anchor['nfs::server::begin'] - -> Class['nfs::server::package'] + Class['nfs::server::package'] -> Class['nfs::server::config'] - # we need the software and a working configuration before running a service - Class['nfs::server::package'] -> Class['nfs::server::service'] - Class['nfs::server::config'] -> Class['nfs::server::service'] - Class['nfs::server::service'] -> Anchor['nfs::server::end'] + -> Class['nfs::server::service'] } else { # make sure all services are getting stopped before software removal - Anchor['nfs::server::begin'] - -> Class['nfs::server::service'] + Class['nfs::server::service'] -> Class['nfs::server::package'] - -> Anchor['nfs::server::end'] } } diff --git a/manifests/server/export.pp b/manifests/server/export.pp index 8283080..7e559d6 100644 --- a/manifests/server/export.pp +++ b/manifests/server/export.pp @@ -1,58 +1,63 @@ -# == Function: nfs::server::export +# Function: nfs::server::export # +# @summary # This Function exists to # 1. manage all exported resources on a nfs server # -# === Parameters +# Parameters # -# [*clients*] +# @param clients # String or Array. Sets the allowed clients and options for the export in the exports file. # Defaults to localhost(ro) # -# [*bind*] +# @param bind # String. Sets the bind options setted in /etc/fstab for the bindmounts created. # Defaults to rbind # -# [*ensure*] +# @param ensure # String. If enabled the mount will be created. Defaults to mounted # -# [*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 exported resource mount. # -# [*options_nfs*] +# @param options_nfs # String. Sets the mount options for a nfs exported resource 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. # -# [*mount*] +# @param mount # String. Sets the mountpoint the client will mount the exported resource mount on. If undef # it defaults to the same path as on the server # -# [*owner*] +# @param owner # String. Sets the owner of the exported directory # -# [*group*] +# @param group # String. Sets the group of the exported directory # -# [*mode*] +# @param mode # String. Sets the permissions of the exported directory. # -# [*server*] +# @param server # String. Sets the hostname clients will use to mount the exported resource. If undef it # defaults to the trusted certname # -# === Examples +# @param v3_export_name +# @param v4_export_name +# @param nfsv4_bindmount_enable +# +# @examples # # class { '::nfs': # server_enabled => true, @@ -66,36 +71,36 @@ # share => 'share_name_on_nfs_server', # } # -# === Links +# Links # # * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY] # # -# === Authors +# @authors # # * Daniel Klockenkaemper +# * Martin Alfke # - define nfs::server::export ( - $v3_export_name = $name, - $v4_export_name = regsubst($name, '.*/(.*)', '\1' ), - $clients = 'localhost(ro)', - $bind = 'rbind', + String[1] $v3_export_name = $name, + String[1] $v4_export_name = regsubst($name, '.*/(.*)', '\1' ), + String[1] $clients = 'localhost(ro)', + String[1] $bind = 'rbind', # globals for this share # propogated to storeconfigs - $ensure = 'mounted', - $mount = undef, - $remounts = false, - $atboot = false, - $options_nfsv4 = $nfs::client_nfsv4_options, - $options_nfs = $nfs::client_nfs_options, - $bindmount = undef, - $nfstag = undef, - $owner = undef, - $group = undef, - $mode = undef, - $server = $facts['clientcert'], - $nfsv4_bindmount_enable = $nfs::nfsv4_bindmount_enable, + String[1] $ensure = 'mounted', + Optional[String[1]] $mount = undef, + 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, + Optional[String[1]] $owner = undef, + Optional[String[1]] $group = undef, + Optional[String[1]] $mode = undef, + String[1] $server = $facts['clientcert'], + Boolean $nfsv4_bindmount_enable = $nfs::nfsv4_bindmount_enable, ) { if $nfs::server::nfs_v4 { if $nfsv4_bindmount_enable {