How to do it...

In this example, we'll configure an nfs server to share (export) a filesystem via NFS:

  1. Create an nfs module with the following nfs::exports class, which defines a concat resource:
class nfs::exports {  exec {'nfs::exportfs':    command     => 'exportfs -a',    refreshonly => true,    path        => '/usr/bin:/bin:/sbin:/usr/sbin',}  concat {'/etc/exports':    notify => Exec['nfs::exportfs'],  }}
  1. Create the nfs::export defined type. We'll use this definition for any NFS exports we create:
define nfs::export (  String $where         = $title,  String $who           = '*',  String $options       = 'async,ro',  String $mount_options = 'defaults',  String $tag           = 'nfs') {  # make sure the directory exists  # export the entry locally, then export a resource to be picked up later.

Get Puppet 5 Cookbook - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.