|
1 |
| -define nfs::server::export ( |
2 |
| - $v3_export_name = $name, |
3 |
| - # Grab the final directory name in the given path and make it our default nfsv4 export name. |
4 |
| - $v4_export_name = regsubst($name, '.*/([^/]+)/?$', '\1' ), |
5 |
| - $clients = 'localhost(ro)', |
6 |
| - $bind = 'rbind', |
7 |
| - # globals for this share |
8 |
| - # propogated to storeconfigs |
9 |
| - $ensure = 'mounted', |
10 |
| - $mount = undef, |
11 |
| - $remounts = false, |
12 |
| - $atboot = false, |
13 |
| - $options = '_netdev', |
14 |
| - $bindmount = undef, |
15 |
| - $nfstag = undef, |
16 |
| - $server = $::clientcert |
17 |
| -) { |
18 |
| -
|
19 |
| -
|
20 |
| - if $nfs::server::nfs_v4 { |
21 |
| -
|
22 |
| - nfs::server::export::nfs_v4::bindmount { $name: |
23 |
| - ensure => $ensure, |
24 |
| - v4_export_name => $v4_export_name, |
25 |
| - bind => $bind, |
26 |
| - } |
27 |
| -
|
28 |
| - nfs::server::export::configure{ |
29 |
| - "${nfs::server::nfs_v4_export_root}/${v4_export_name}": |
30 |
| - ensure => $ensure, |
31 |
| - clients => $clients, |
32 |
| - require => Nfs::Server::Export::Nfs_v4::Bindmount[$name] |
33 |
| - } |
34 |
| -
|
35 |
| - @@nfs::client::mount {"shared ${v4_export_name} by ${::clientcert}": |
36 |
| - ensure => $ensure, |
37 |
| - mount => $mount, |
38 |
| - remounts => $remounts, |
39 |
| - atboot => $atboot, |
40 |
| - options => $options, |
41 |
| - bindmount => $bindmount, |
42 |
| - nfstag => $nfstag, |
43 |
| - share => $v4_export_name, |
44 |
| - server => $server, |
45 |
| - } |
46 |
| -
|
47 |
| - } else { |
48 |
| -
|
49 |
| - nfs::server::export::configure{ |
50 |
| - $v3_export_name: |
51 |
| - ensure => $ensure, |
52 |
| - clients => $clients, |
53 |
| - } |
54 |
| -
|
55 |
| - if $mount == undef { |
56 |
| - $_mount = $v3_export_name |
57 |
| - } else { |
58 |
| - $_mount = $mount |
59 |
| - } |
60 |
| -
|
61 |
| - @@nfs::client::mount {"shared ${v3_export_name} by ${::clientcert}": |
62 |
| - ensure => $ensure, |
63 |
| - mount => $_mount, |
64 |
| - remounts => $remounts, |
65 |
| - atboot => $atboot, |
66 |
| - options => $options, |
67 |
| - nfstag => $nfstag, |
68 |
| - share => $v3_export_name, |
69 |
| - server => $server, |
70 |
| - } |
71 |
| - } |
72 |
| -} |
| 1 | +define nfs::server::export ( |
| 2 | + $v3_export_name = $name, |
| 3 | + # Grab the final directory name in the given path and make it our default nfsv4 export name. |
| 4 | + $v4_export_name = regsubst($name, '.*/([^/]+)/?$', '\1'), |
| 5 | + $clients = 'localhost(ro)', |
| 6 | + $bind = 'rbind', |
| 7 | + $owner = 'root', |
| 8 | + $group = 'root', |
| 9 | + $perms = '0755', |
| 10 | + # globals for this share |
| 11 | + # propogated to storeconfigs |
| 12 | + $ensure = 'mounted', |
| 13 | + $mount = undef, |
| 14 | + $remounts = false, |
| 15 | + $atboot = false, |
| 16 | + $options = '_netdev', |
| 17 | + $bindmount = undef, |
| 18 | + $nfstag = undef, |
| 19 | + $server = $::clientcert) { |
| 20 | + if $nfs::server::nfs_v4 { |
| 21 | + nfs::server::export::nfs_v4::bindmount { $name: |
| 22 | + ensure => $ensure, |
| 23 | + v4_export_name => $v4_export_name, |
| 24 | + bind => $bind, |
| 25 | + owner => $owner, |
| 26 | + group => $group, |
| 27 | + perms => $perms, |
| 28 | + } |
| 29 | +
|
| 30 | + nfs::server::export::configure { "${nfs::server::nfs_v4_export_root}/${v4_export_name}": |
| 31 | + ensure => $ensure, |
| 32 | + clients => $clients, |
| 33 | + require => Nfs::Server::Export::Nfs_v4::Bindmount[$name] |
| 34 | + } |
| 35 | +
|
| 36 | + @@nfs::client::mount { "shared ${v4_export_name} by ${::clientcert}": |
| 37 | + ensure => $ensure, |
| 38 | + mount => $mount, |
| 39 | + remounts => $remounts, |
| 40 | + atboot => $atboot, |
| 41 | + options => $options, |
| 42 | + bindmount => $bindmount, |
| 43 | + nfstag => $nfstag, |
| 44 | + share => $v4_export_name, |
| 45 | + server => $server, |
| 46 | + } |
| 47 | +
|
| 48 | + } else { |
| 49 | + nfs::server::export::configure { $v3_export_name: |
| 50 | + ensure => $ensure, |
| 51 | + clients => $clients, |
| 52 | + } |
| 53 | +
|
| 54 | + if $mount == undef { |
| 55 | + $_mount = $v3_export_name |
| 56 | + } else { |
| 57 | + $_mount = $mount |
| 58 | + } |
| 59 | +
|
| 60 | + @@nfs::client::mount { "shared ${v3_export_name} by ${::clientcert}": |
| 61 | + ensure => $ensure, |
| 62 | + mount => $_mount, |
| 63 | + remounts => $remounts, |
| 64 | + atboot => $atboot, |
| 65 | + options => $options, |
| 66 | + nfstag => $nfstag, |
| 67 | + share => $v3_export_name, |
| 68 | + server => $server, |
| 69 | + } |
| 70 | + } |
| 71 | +} |
0 commit comments