Forge Home

nfs

Manage NFS client and server services

517 downloads

211 latest version

5.0 quality score

Version information

  • 0.1.1 (latest)
  • 0.1.0
released Jul 1st 2022
This version is compatible with:
  • Puppet Enterprise 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x
  • Puppet >= 6.21.0 < 8.0.0
  • ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'jcpunk-nfs', '0.1.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add jcpunk-nfs
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install jcpunk-nfs --version 0.1.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

jcpunk/nfs — version 0.1.1 Jul 1st 2022

nfs

Manage NFS client/server elements with modern nfs-utils.

Table of Contents

  1. Description
  2. Setup - The basics of getting started with nfs
  3. Usage - Configuration options and additional functionality
  4. Limitations - OS compatibility, etc.
  5. Development - Guide for contributing to the module

Description

The nfs-utils version 2 utilities can take most of their settings from the /etc/nfs.conf. This module attempts to make setting those options easier.

Similiarly, mount.nfs can get options from /etc/nfsmount.conf.

Additionally, an easy way to populate /etc/idmapd.conf is provided.

This module also provides an interface to setup NFS exports.

Folks wanting to mount NFS shares should use the mount type.

Setup

What nfs affects

This module will manage the NFS packages, configs, exports, and services.

Setup Requirements

See the metadata.json for module requirements.

Beginning with nfs

By default this module will disable client and server elements. You'll need to decide which bits you want enabled on what hosts.

This module should work well with hiera or a feature rich ENC.

Usage

Setup a client permitting NFSv3 and NFSv4 along with Kerberos security:

class {'nfs':
  client => true,
  client_nfsv3_support => true,
  client_nfsv4_support => true,
  client_kerberos_support => true,
}

or hiera

nfs::client: true
nfs::client_nfsv3_support: true
nfs::client_nfsv4_support: true
nfs::client_kerberos_support: true

Setup host as a client and a server:

class {'nfs':
  client => true,
  server => true,
}

or hiera

nfs::client: true
nfs::server: true

Setup a server permitting NFSv3 and NFSv4 along with Kerberos security and GSSProxy. Also setup two exports, but leave any unmanaged files in /etc/exports.d/ NOTE: if you drop your own files in /etc/exports.d/ you should notify one of: Class['nfs'] Class['nfs::service'] `Class['nfs::service::exportfs']

class {'nfs':
  use_gssproxy => true,

  server => true,
  server_nfsv3_support => true,
  server_nfsv4_support => true,
  server_kerberos_support => true,

  exportfs_arguments => [ '-a', ],
  purge_unmanaged_exports => false,
  exports => {
    '/export/path' => {
      'clients' => {
        '127.0.0.1' => ['rw', 'no_subtree_check'],
        '*.example.com' => ['rw', 'sec=krb5', 'no_subtree_check'],
      }
    },
    'Detailed Example' => {
      'export_path' => '/my/nfs/path',
      'config_file' => '/etc/exports.d/puppet.exports',
      'comment' => "Some Optional Free Text",
      'clients' => {
        '127.0.0.1' => ['rw', 'no_subtree_check'],
        '*.example.com' => ['rw', 'sec=krb5', 'no_subtree_check'],
      }
    }
  }
}

or hiera

nfs::use_gssproxy: true
nfs::server: true
nfs::server_nfsv3_support: true
nfs::server_nfsv4_support: true
nfs::server_kerberos_support: true
nfs::purge_unmanaged_exports: false
nfs::exportfs_arguments: [ '-a' ]

# setup merge so we can extend this at another level
lookup_options:
  nfs::exports:
    merge:
      strategy: deep

nfs::exports:
  '/export/path':
    clients:
      '127.0.0.1':
        - rw
        - no_subtree_check
      '*.example.com':
        - rw
        - 'sec=krb5'
        - no_subtree_check
  'Detailed Example':
    export_path: /my/nfs/path
    config_file: /etc/exports.d/puppet.exports
    comment: Some Optional Free Text
        clients:
      '127.0.0.1':
        - rw
        -no_subtree_check
      '*.example.com':
        - rw
        - 'sec=krb5'
        - no_subtree_check

Set specific config settings for individual services NOTE: if you drop your own files in /etc/nfs.conf.d/ you should notify one of: Class['nfs'] Class['nfs::service'] NOTE: if you drop your own files in /etc/nfsmount.conf.d/ you should notify any relevant NFS mounts you've specified.

class {'nfs':
  client => true,
  server => true,
  rpcbind_config_opt_values => ['-a', '-s', '-l'],
  idmapd_config_hash => {
    'General' => {
      'Domain' => 'something',
      'Reformat-Group' => 'both',
    },
    'Mapping' => {
      'Nobody-User' => 'nouser',
    },
  },
  nfs_conf_hash => {
    'lockd' => {
      'port' => 32803,
      'udp-port' => 32769
    },
    'mountd' => {
      'port' => 892
    },
    'statd' => {
      'port' => 662,
      'outgoing-port' => 2020
    },
  },
  nfsmount_conf_hash => {
    'hostname.example.com' => {
      'Defaultvers' => 4,
    },
    '/my/mnt/point' => {
      'Defaultvers' => 4,
    },
  }
}

or hiera

nfs::client: true
nfs::server: true
nfs::rpcbind_config_opt_values:
  - '-a'
  - '-s'
  - '-l'

# setup merge so we can extend this at another level
lookup_options:
  nfs::idmapd_config_hash:
    merge:
      strategy: deep
  nfs::nfs_conf_hash:
    merge:
      strategy: deep
  nfs::nfsmount_conf_hash:
    merge:
      strategy: deep

nfs::idmapd_config_hash:
  General:
    Domain: something
    Reformat-Group: both
  Mapping:
    Nobody-User: nouser
nfs::nfs_conf_hash:
  lockd:
    port: 32803
    udp-port: 32769
  mountd:
    port: 982
  statd:
    port: 662
    outgoing-port: 2020
nfs::nfsmount_conf_hash:
  hostname.example.com:
    Defaultvers: 4
  '/my/mnt/point':
    Defaultvers: 4

Additional examples are provided in the examples directory.

Limitations

This primarily targeted at RHEL compatible systems with nfs-utils version 2. Limited support for RHEL7 and Debian style systes are provided.

Development

This project uses pdk and is hosted at the listed repo.