O'Reilly logo

Puppet 5 Cookbook - Fourth Edition by Thomas Uphill

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required