How it works...

The nfs::exports class defines an exec, which runs exportfs -a, to export all filesystems defined in /etc/exports. Next, we define a concat resource to contain concat::fragments, which we will define next in our nfs::export class. concat resources specify the file that the fragments are to be placed into; /etc/exports in this case. Our concat resource has a notify for the previous exec. This has the effect that whenever /etc/ exports is updated, we run exportfs -a again to export the new entries:

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'],   } } 

We then created an nfs::export ...

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.