Puppet Class: nfs

Defined in:
manifests/init.pp

Overview

Parameters:

  • ensure (Enum['present', 'absent', 'running', 'stopped', 'disabled']) (defaults to: 'present')

    Controls if the managed resources shall be ‘present` or `absent`.

    If set to ‘absent`:

    • The managed software packages are being uninstalled.

    • Any traces of the packages will be purged as good as possible. This may include existing configuration files. The exact behavior is provider dependent.

    • System modifications (if any) will be reverted as good as possible (e.g. removal of created users, services, changed log settings, …).

    • This is thus destructive and should be used with care.

  • server_enabled (Boolean) (defaults to: false)

    If set to ‘true`, this module will configure the node to act as a NFS server.

  • client_enabled (Boolean) (defaults to: false)

    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 (Boolean) (defaults to: true)

    If set to ‘false`, this module will not export any resources as storeconfigs.

  • nfs_v4 (Boolean) (defaults to: false)

    If set to ‘true`, this module will use NFS version 4 for exporting and mounting NFS resources.

  • nfs_v4_client (Boolean) (defaults to: false)

    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.

  • exports_file (Stdlib::Absolutepath)

    It defines the location of file with the NFS export resources used by the NFS server.

  • idmapd_file (Stdlib::Absolutepath)

    It defines the location of the file with the idmapd settings.

  • defaults_file (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    It defines the location of the file with the NFS settings.

  • manage_packages (Boolean) (defaults to: true)

    It defines if the packages should be managed through this module.

  • server_packages (Array)

    It defines the packages needed to be installed for acting as a NFS server.

  • server_package_ensure (String) (defaults to: 'installed')

    It defines the packages state - any of ‘present`, `installed`, `absent`, `purged`, `held`, `latest`.

  • client_packages (Array)

    It defines the packages needed to be installed for acting as a NFS client

  • client_package_ensure (String) (defaults to: 'installed')

    It defines the packages state - any of ‘present`, `installed`, `absent`, `purged`, `held`, `latest`.

  • manage_server_service (Boolean) (defaults to: true)

    Defines if module should manage server_service.

  • manage_server_servicehelper (Boolean) (defaults to: true)

    Defines if module should manage server_servicehelper.

  • manage_client_service (Boolean) (defaults to: true)

    Defines if module should manage client_service.

  • server_service_name (String)

    It defines the servicename of the NFS server service.

  • server_service_ensure (Enum['present', 'absent', 'running', 'stopped', 'disabled']) (defaults to: 'running')

    It defines the service parameter ensure for NFS server services.

  • server_service_enable (Boolean) (defaults to: true)

    It defines the service parameter enable for NFS server service.

  • server_service_hasrestart (Boolean) (defaults to: true)

    It defines the service parameter hasrestart for NFS server service.

  • server_service_hasstatus (Boolean) (defaults to: true)

    It defines the service parameter hasstatus for NFS server service.

  • server_service_restart_cmd (Optional[String[1]]) (defaults to: undef)

    It defines the service parameter restart for NFS server service.

  • server_nfsv4_servicehelper (Optional[Array[String[1]]]) (defaults to: undef)

    It defines the service helper like idmapd for servers configured with NFS version 4.

  • client_services (Hash)

    It defines the servicenames need to be started when acting as a NFS client.

  • client_nfsv4_services (Hash)

    It defines the servicenames need to be started when acting as a NFS client version 4.

  • client_services_enable (Boolean)

    It defines the service parameter enable for NFS client services.

  • client_idmapd_setting (Array[String]) (defaults to: [])

    It defines the Augeas parameter added in @param defaults_file when acting as a NFS version 4 client.

  • client_nfs_fstype (String[1]) (defaults to: 'nfs')

    It defines the name of the NFS filesystem, when adding entries to ‘/etc/fstab` on a client node.

  • 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 (String)

    It defines the name of the NFS version 4 filesystem, when adding entries to ‘/etc/fstab` on a client node.

  • client_nfsv4_options (String)

    It defines the options for the NFS version 4 filesystem, when adding entries to ‘/etc/fstab` on a client node.

  • nfs_v4_export_root (String) (defaults to: '/export')

    It defines the location where NFS version 4 exports should be bindmounted to on a server node.

  • nfs_v4_export_root_clients (String) (defaults to: "*.${facts['networking']['domain']}(ro,fsid=root,insecure,no_subtree_check,async,root_squash)")

    It defines the clients that are allowed to mount NFS version 4 exports and includes the option string.

  • nfs_v4_mount_root (String) (defaults to: '/srv')

    It defines the location where NFS version 4 clients find the mount root on a server node.

  • nfs_v4_idmap_domain (String) (defaults to: pick($facts['networking']['domain'], 'example.org'))

    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.

  • nfsv4_bindmount_enable (Boolean) (defaults to: true)

    It defines if the module should create a bindmount for the export.

  • client_need_gssd (Boolean) (defaults to: false)

    If ‘true`, sets `NEED_GSSD=yes` in `/etc/defauls/nfs-common`, usable on Debian/Ubuntu.

  • client_gssd_service (Boolean) (defaults to: false)

    If ‘true` enable rpc-gssd service.

  • client_gssd_options (Optional[String[1]]) (defaults to: undef)

    Options for rpc-gssd service.

  • client_d9_gssdopt_workaround (Boolean) (defaults to: false)

    If enabled, workaround for passing gssd_options which is broken on Debian 9. Usable only on Debian 9.

  • nfs_v4_idmap_localrealms (Variant[String, Array]) (defaults to: '')

    ‘Local-Realms` option for idmapd.

  • nfs_v4_idmap_cache (Integer) (defaults to: 0)

    ‘Cache-Expiration` option for idmapd. If `0` cache is unused.

  • manage_nfs_v4_idmap_nobody_mapping (Boolean) (defaults to: false)

    Enable setting Nobody mapping in idmapd.

  • nfs_v4_idmap_nobody_user (String)

    ‘Nobody-User` option for idmapd.

  • nfs_v4_idmap_nobody_group (String)

    ‘Nobody-Group` option for idmapd.

  • client_rpcbind_config (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    It defines the location of the file with the rpcbind config.

  • client_rpcbind_optname (Optional[String]) (defaults to: undef)

    It defines the name of environment variable that holds the rpcbind config. E.g. OPTIONS for Debian.

  • client_rpcbind_opts (Optional[String]) (defaults to: undef)

    Options for rpcbind service.

  • nfs_v4_root_export_ensure (String) (defaults to: 'mounted')

    It defines the state of the NFS version 4 root export.

  • nfs_v4_root_export_mount (Optional[String]) (defaults to: undef)

    It defines the mountpoint of the NFS version 4 root export.

  • nfs_v4_root_export_remounts (Boolean) (defaults to: false)

    It defines if the NFS version 4 root export should be remounted.

  • nfs_v4_root_export_atboot (Boolean) (defaults to: false)

    It defines if the NFS version 4 root export should be mounted at boot.

  • nfs_v4_root_export_options (String) (defaults to: '_netdev')

    It defines the options for the NFS version 4 root export.

  • nfs_v4_root_export_bindmount (Optional[String]) (defaults to: undef)

    It defines the bindmount of the NFS version 4 root export.

  • nfs_v4_root_export_tag (Optional[String]) (defaults to: undef)

    It defines the tag of the NFS version 4 root export.

  • client_gssd_service_name (Optional[Hash]) (defaults to: undef)

    It defines the servicename of the rpc-gssd service.

  • client_services_hasrestart (Boolean) (defaults to: true)

    It defines the service parameter hasrestart for NFS client services.

  • client_services_hasstatus (Boolean) (defaults to: true)

    It defines the service parameter hasstatus for NFS client services.

  • client_gssdopt_name (String)

    It defines the name of the gssd option in ‘/etc/default/nfs-common`.

See Also:

Author:

    • Daniel Klockenkaemper <dk@marketing-factory.de>

    • Martin Alfke <tuxmea@gmail.com>



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'manifests/init.pp', line 198

class nfs (
  Stdlib::Absolutepath $exports_file,
  Stdlib::Absolutepath $idmapd_file,
  Array $server_packages,
  Array $client_packages,
  String $server_service_name,
  Hash $client_services,
  Hash $client_nfsv4_services,
  Boolean $client_services_enable,
  String $client_nfs_options,
  String $client_nfsv4_fstype,
  String $client_nfsv4_options,
  String $client_gssdopt_name,
  String $nfs_v4_idmap_nobody_user,
  String $nfs_v4_idmap_nobody_group,
  Boolean $server_service_hasrestart = true,
  Boolean $server_service_hasstatus = true,
  Optional[String[1]] $client_gssd_options = undef,
  Boolean $client_services_hasrestart = true,
  Boolean $client_services_hasstatus = true,
  String[1] $client_nfs_fstype = 'nfs',
  Array[String] $client_idmapd_setting = [],
  Optional[Hash] $client_gssd_service_name = undef,
  Optional[String[1]] $server_service_restart_cmd = undef,
  Optional[Array[String[1]]] $server_nfsv4_servicehelper = undef,
  Optional[Stdlib::Absolutepath] $client_rpcbind_config = undef,
  Optional[String] $client_rpcbind_optname = undef,
  Optional[Stdlib::Absolutepath] $defaults_file = undef,
  Optional[String] $nfs_v4_root_export_mount = undef,
  Optional[String] $nfs_v4_root_export_bindmount = undef,
  Optional[String] $nfs_v4_root_export_tag = undef,
  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 = false,
  Boolean $nfs_v4_client = false,
  Boolean $manage_packages = true,
  String $server_package_ensure = 'installed',
  String $client_package_ensure = 'installed',
  Boolean $manage_server_service = true,
  Boolean $manage_server_servicehelper = true,
  Boolean $manage_client_service = true,
  Enum['present', 'absent', 'running', 'stopped', 'disabled'] $server_service_ensure = 'running',
  Boolean $server_service_enable = true,
  Boolean $client_need_gssd = false,
  Boolean $client_gssd_service = false,
  Boolean $client_d9_gssdopt_workaround = false,
  String $nfs_v4_export_root = '/export',
  String $nfs_v4_export_root_clients = "*.${facts['networking']['domain']}(ro,fsid=root,insecure,no_subtree_check,async,root_squash)",
  String $nfs_v4_mount_root = '/srv',
  String $nfs_v4_idmap_domain = pick($facts['networking']['domain'], 'example.org'),
  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_root_export_ensure = 'mounted',
  Boolean $nfs_v4_root_export_remounts = false,
  Boolean $nfs_v4_root_export_atboot = false,
  String $nfs_v4_root_export_options = '_netdev',
  Boolean $nfsv4_bindmount_enable = true,
) {
  if $server_enabled {
    if $server_nfsv4_servicehelper != undef {
      $effective_nfsv4_client_services = $client_nfsv4_services - $server_nfsv4_servicehelper
    } else {
      $effective_nfsv4_client_services = $client_nfsv4_services
    }

    $effective_client_services = $client_services
    $effective_client_packages = $client_packages - $server_packages
  } else {
    if $client_gssd_service and $client_gssd_service_name != undef {
      $effective_nfsv4_client_services = $client_nfsv4_services + $client_gssd_service_name
    } else {
      $effective_nfsv4_client_services = $client_nfsv4_services
    }

    $effective_client_services = $client_services
    $effective_client_packages = $client_packages
  }

  if $server_enabled {
    class { 'nfs::server': }
  }

  if $client_enabled {
    class { 'nfs::client': }
  }
}