ghoneycutt / puppet-module-nfs

Puppet module to manage NFS
Other
4 stars 30 forks source link

puppet-module-nfs

Build Status

Puppet module to manage NFS client and server

Components

Server


Idmap


Compatibility

This module has been tested to work on the following systems with Puppet v4, v5 and v6 using the ruby versions that are shipped with each. See .travis.yml for the exact matrix.

Suse notes

If using Suse, there is a known issue regarding reverse path filtering which can be solved through kernel tuning.

http://www.novell.com/support/kb/doc.php?id=7007649

===

Parameters

hiera_hash

Boolean to use hiera_hash which merges all found instances of nfs::mounts in Hiera. This is useful for specifying mounts at different levels of the hierarchy and having them all included in the catalog.

nfs_package

Name of the NFS package. May be a string or an array.

nfs_service

Name of the NFS service

mounts

Hash of mounts to be mounted on system. See below.

server

Boolean to specify if the system is an NFS server.

exports_path

The location of the config file.

exports_owner

The owner of the config file.

exports_group

The group for the config file.

exports_mode

The mode for the config file.

===

Class nfs::idmap

Parameters

idmap_package

String of the idmap package name.

idmapd_conf_path

The location of the config file.

idmapd_conf_owner

The owner of the config file.

idmapd_conf_group

The group for the config file.

idmapd_conf_mode

The mode for the config file.

idmapd_service_name

String of the service name.

idmapd_service_ensure

Boolean value of ensure parameter for idmapd service. Default is based on the platform. If running EL7 as an nfs-server, this must be set to 'running'.

idmapd_service_enable

Boolean value of enable parameter for idmapd service.

idmapd_service_hasstatus

Boolean value of hasstatus parameter for idmapd service.

idmapd_service_hasrestart

Boolean value of hasrestart parameter for idmapd service.

idmap_domain

String value of domain to be set as local NFS domain.

ldap_server

String value of ldap server name.

ldap_base

String value of ldap search base.

local_realms

String or array of local kerberos realm names.

translation_method

String or array of mapping method to be used between NFS and local IDs. Valid values is nsswitch, umich_ldap or static.

nobody_user

String of local user name to be used when a mapping cannot be completed.

nobody_group

String of local group name to be used when a mapping cannot be completed.

verbosity

Integer of verbosity level.

pipefs_directory

String of the directory for rpc_pipefs.

===

Manage mounts

This works by iterating through the nfs::mounts hash and calling the types::mount resource. Thus, you can provide any valid parameter for mount. See the Type Reference for a complete list.

Example:

Mount nfs.example.com:/vol1 on /mnt/vol1 and nfs.example.com:/vol2 on /mnt/vol2

nfs::mounts:
  /mnt/vol1:
    device: nfs.example.com:/vol1
    options: rw,rsize=8192,wsize=8192
    fstype: nfs
  old_log_file_mount:
    name: /mnt/vol2
    device: nfs.example.com:/vol2
    fstype: nfs

Manage exports

This module manages /etc/exports though does not manage its contents. Suggest using the file_line resource in your profile as demonstrated below.

class profile::nfs_server {

  include ::nfs

  file_line { 'exports_home':
    path => '/etc/exports',
    line => '/home 192.168.42.0/24(sync,no_root_squash)',
  }

  file_line { 'exports_data':
    path => '/etc/exports',
    line => '/data 192.168.23.0/24(sync,no_root_squash,rw)',
  }
}

Creating Hiera data from existing system

This module contains ext/fstabnfs2yaml.rb, which is a script that will parse /etc/fstab and print out the nfs::mounts hash in YAML with which you can copy/paste into Hiera.