Managing NFS servers and file shares
NFS (the Network File System) is a protocol for mounting a shared directory from a remote server. For example, a pool of web servers might all mount the same NFS share to serve static assets such as images and stylesheets. Although NFS is rather old technology, it's still widely used, so you will very likely come across it.
How to do it…
Here's a recipe that will show you how to create an NFS server using Puppet and set up shared directories:
Run the following command:
ubuntu@cookbook:~/puppet$ mkdir -p modules/nfs/manifests
Create the file
modules/nfs/manifests/init.pp
with the following contents:# Manage NFS server class nfs { package { 'nfs-kernel-server': ensure => installed } service { 'nfs-kernel-server': ensure => running, enable => true, hasrestart => true, require => Package['nfs-kernel-server'], } file { '/etc/exports.d': ensure => directory, } exec { 'update-etc-exports': command...