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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.