diff options
author | Tom De Vylder <tom@penumbra.be> | 2012-11-27 16:44:18 +0100 |
---|---|---|
committer | Tom De Vylder <tom@penumbra.be> | 2012-11-27 16:57:32 +0100 |
commit | dd1e1fd538890e2f76baeeb26fed56f329fbd670 (patch) | |
tree | 877af371ef4310caac6c571e1440cea0f0c99e53 | |
parent | 1bb42e761914c0e6dc3cb7902634caf4ab35b90f (diff) | |
download | puppet-nfs-dd1e1fd538890e2f76baeeb26fed56f329fbd670.tar.gz puppet-nfs-dd1e1fd538890e2f76baeeb26fed56f329fbd670.tar.bz2 |
Add exports
-rw-r--r-- | README.md | 20 | ||||
-rw-r--r-- | manifests/config.pp | 15 | ||||
-rw-r--r-- | manifests/export.pp | 22 | ||||
-rw-r--r-- | templates/export.erb | 3 |
4 files changed, 55 insertions, 5 deletions
@@ -25,3 +25,23 @@ } } +### Export NFS shares + + node /box/ { + class { 'nfs': + server => true; + } + + nfs::export { '/srv/nfs01 10.0.1.1/24': + export_directory => '/srv/nfs01', + export_target => '10.0.1.1/24', + export_options => 'rw,sync,no_root_squash', + } + + nfs::export { '/srv/nfs01 10.0.2.1/24': + export_directory => '/srv/nfs01', + export_target => '10.0.2.1/24', + export_options => 'rw,sync,no_root_squash', + } + } + diff --git a/manifests/config.pp b/manifests/config.pp index e55cb59..a9e5222 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -9,12 +9,17 @@ class nfs::config { group => $::nfs::config_group, } - if $::nfs::client { - } - if $::nfs::server { - file { $::nfs::config_file: - ensure => directory, + concat { $::nfs::config_file: + group => $::nfs::config_group, + mode => $::nfs::config_mode, + owner => $::nfs::config_user, + } + + concat::fragment { 'export_header': + target => $::nfs::config_file, + content => "# Managed by Puppet\n\n", + order => 01, } } } diff --git a/manifests/export.pp b/manifests/export.pp new file mode 100644 index 0000000..9584255 --- /dev/null +++ b/manifests/export.pp @@ -0,0 +1,22 @@ +# = Define: nfs::export +# +define nfs::export ( + $export_directory, + $export_target, + $ensure = present, + $export_options = 'no_root_squash', +) { + + if ! $::nfs::server { + fail 'NFS server support is not enabled.' + } + + if $ensure == present { + concat::fragment { "export_${name}": + target => $::nfs::config_file, + content => template('nfs/export.erb'), + order => 10, + } + } +} + diff --git a/templates/export.erb b/templates/export.erb new file mode 100644 index 0000000..fa882eb --- /dev/null +++ b/templates/export.erb @@ -0,0 +1,3 @@ +# <%= scope.lookupvar('name') -%> +<%= scope.lookupvar('export_directory') -%> <%= scope.lookupvar('export_target') -%>(<%= scope.lookupvar('export_options') -%>) + |