This repository has been archived by the owner on Sep 29, 2020. It is now read-only.
forked from haraldsk/puppet-module-nfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request haraldsk#31 from CDLSoftware/issue30_setOwnershipT…
…hroughExport Issue haraldsk#30 Add ability to set owner,group,perms on server::export
- Loading branch information
Showing
3 changed files
with
109 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,71 @@ | ||
define nfs::server::export ( | ||
$v3_export_name = $name, | ||
# Grab the final directory name in the given path and make it our default nfsv4 export name. | ||
$v4_export_name = regsubst($name, '.*/([^/]+)/?$', '\1' ), | ||
$clients = 'localhost(ro)', | ||
$bind = 'rbind', | ||
# globals for this share | ||
# propogated to storeconfigs | ||
$ensure = 'mounted', | ||
$mount = undef, | ||
$remounts = false, | ||
$atboot = false, | ||
$options = '_netdev', | ||
$bindmount = undef, | ||
$nfstag = undef, | ||
$server = $::clientcert | ||
) { | ||
if $nfs::server::nfs_v4 { | ||
nfs::server::export::nfs_v4::bindmount { $name: | ||
ensure => $ensure, | ||
v4_export_name => $v4_export_name, | ||
bind => $bind, | ||
} | ||
nfs::server::export::configure{ | ||
"${nfs::server::nfs_v4_export_root}/${v4_export_name}": | ||
ensure => $ensure, | ||
clients => $clients, | ||
require => Nfs::Server::Export::Nfs_v4::Bindmount[$name] | ||
} | ||
@@nfs::client::mount {"shared ${v4_export_name} by ${::clientcert}": | ||
ensure => $ensure, | ||
mount => $mount, | ||
remounts => $remounts, | ||
atboot => $atboot, | ||
options => $options, | ||
bindmount => $bindmount, | ||
nfstag => $nfstag, | ||
share => $v4_export_name, | ||
server => $server, | ||
} | ||
} else { | ||
nfs::server::export::configure{ | ||
$v3_export_name: | ||
ensure => $ensure, | ||
clients => $clients, | ||
} | ||
if $mount == undef { | ||
$_mount = $v3_export_name | ||
} else { | ||
$_mount = $mount | ||
} | ||
@@nfs::client::mount {"shared ${v3_export_name} by ${::clientcert}": | ||
ensure => $ensure, | ||
mount => $_mount, | ||
remounts => $remounts, | ||
atboot => $atboot, | ||
options => $options, | ||
nfstag => $nfstag, | ||
share => $v3_export_name, | ||
server => $server, | ||
} | ||
} | ||
} | ||
define nfs::server::export ( | ||
$v3_export_name = $name, | ||
# Grab the final directory name in the given path and make it our default nfsv4 export name. | ||
$v4_export_name = regsubst($name, '.*/([^/]+)/?$', '\1'), | ||
$clients = 'localhost(ro)', | ||
$bind = 'rbind', | ||
$owner = 'root', | ||
$group = 'root', | ||
$perms = '0755', | ||
# globals for this share | ||
# propogated to storeconfigs | ||
$ensure = 'mounted', | ||
$mount = undef, | ||
$remounts = false, | ||
$atboot = false, | ||
$options = '_netdev', | ||
$bindmount = undef, | ||
$nfstag = undef, | ||
$server = $::clientcert) { | ||
if $nfs::server::nfs_v4 { | ||
nfs::server::export::nfs_v4::bindmount { $name: | ||
ensure => $ensure, | ||
v4_export_name => $v4_export_name, | ||
bind => $bind, | ||
owner => $owner, | ||
group => $group, | ||
perms => $perms, | ||
} | ||
nfs::server::export::configure { "${nfs::server::nfs_v4_export_root}/${v4_export_name}": | ||
ensure => $ensure, | ||
clients => $clients, | ||
require => Nfs::Server::Export::Nfs_v4::Bindmount[$name] | ||
} | ||
@@nfs::client::mount { "shared ${v4_export_name} by ${::clientcert}": | ||
ensure => $ensure, | ||
mount => $mount, | ||
remounts => $remounts, | ||
atboot => $atboot, | ||
options => $options, | ||
bindmount => $bindmount, | ||
nfstag => $nfstag, | ||
share => $v4_export_name, | ||
server => $server, | ||
} | ||
} else { | ||
nfs::server::export::configure { $v3_export_name: | ||
ensure => $ensure, | ||
clients => $clients, | ||
} | ||
if $mount == undef { | ||
$_mount = $v3_export_name | ||
} else { | ||
$_mount = $mount | ||
} | ||
@@nfs::client::mount { "shared ${v3_export_name} by ${::clientcert}": | ||
ensure => $ensure, | ||
mount => $_mount, | ||
remounts => $remounts, | ||
atboot => $atboot, | ||
options => $options, | ||
nfstag => $nfstag, | ||
share => $v3_export_name, | ||
server => $server, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
define nfs::server::export::nfs_v4::bindmount ( | ||
$v4_export_name, | ||
$bind, | ||
$ensure = 'mounted', | ||
) { | ||
|
||
$expdir = "${nfs::server::nfs_v4_export_root}/${v4_export_name}" | ||
|
||
nfs::mkdir{ $expdir: } | ||
|
||
mount { | ||
$expdir: | ||
ensure => $ensure, | ||
device => $name, | ||
atboot => true, | ||
fstype => 'none', | ||
options => $bind, | ||
require => Nfs::Mkdir[$expdir], | ||
} | ||
|
||
} | ||
define nfs::server::export::nfs_v4::bindmount ( | ||
$v4_export_name, | ||
$bind, | ||
$ensure = 'mounted', | ||
$owner = 'root', | ||
$group = 'root', | ||
$perms = '0755') { | ||
$expdir = "${nfs::server::nfs_v4_export_root}/${v4_export_name}" | ||
|
||
nfs::mkdir { $expdir: | ||
owner => $owner, | ||
group => $group, | ||
perm => $perms | ||
} | ||
|
||
mount { $expdir: | ||
ensure => $ensure, | ||
device => $name, | ||
atboot => true, | ||
fstype => 'none', | ||
options => $bind, | ||
require => Nfs::Mkdir[$expdir], | ||
} | ||
|
||
} |