
# Install NFS client.
#
class nfs::client {

    package { "nfs-utils":
	ensure => installed,
    }

    service { "nfslock":
	ensure    => running,
	enable    => true,
	hasstatus => true,
	require   => Package["nfs-utils"],
    }

}


# Install and configure NFS server.
#
class nfs::server inherits nfs::client {

    include portmap::server

    file { "/etc/exports":
	ensure  => present,
	source  => [ "puppet:///files/nfs/exports.${fqdn}",
		     "puppet:///modules/nfs/exports", ],
	mode    => 0644,
	owner   => root,
	group   => root,
	require => Package["nfs-utils"],
	notify  => Exec["exportfs"],
    }

    file { "/etc/sysconfig/nfs":
	ensure  => present,
	source  => "puppet:///modules/nfs/nfs.sysconfig",
	mode    => 0644,
	owner   => root,
	group   => root,
	notify  => Service["nfs"],
    }

    service { "nfs":
	ensure    => running,
	enable    => true,
	hasstatus => true,
	require   => Package["nfs-utils"],
    }

    exec { "exportfs":
	command     => "exportfs -av",
	path        => "/bin:/usr/bin:/sbin:/usr/sbin",
	refreshonly => true,
	require     => Service["nfs"],
    }

}
