aboutsummaryrefslogtreecommitdiff
path: root/manifests/server
diff options
context:
space:
mode:
authorAdam Jahn <ajjahn@gmail.com>2012-08-24 13:25:55 -0400
committerAdam Jahn <ajjahn@gmail.com>2012-08-24 13:25:55 -0400
commit834b88cd9f9f0062f8ff9308531f4f543bf54e38 (patch)
tree63ca6c5c25c481c58c4aa3d9ea06c3f5d057f5f4 /manifests/server
parent093862a340288468e8d27d1fe0eedc567f468e56 (diff)
downloadpuppet-samba-834b88cd9f9f0062f8ff9308531f4f543bf54e38.tar.gz
puppet-samba-834b88cd9f9f0062f8ff9308531f4f543bf54e38.tar.bz2
share is part of the server family
Diffstat (limited to 'manifests/server')
-rw-r--r--manifests/server/share.pp66
1 files changed, 66 insertions, 0 deletions
diff --git a/manifests/server/share.pp b/manifests/server/share.pp
new file mode 100644
index 0000000..51341e3
--- /dev/null
+++ b/manifests/server/share.pp
@@ -0,0 +1,66 @@
+define samba::server::share($ensure = present,
+ $description = '',
+ $path = '',
+ $browsable = '',
+ $guest_ok = '',
+ $read_only = '') {
+
+ $context = "/files/etc/samba/smb.conf"
+ $target = "target[. = '${name}']"
+
+ augeas { "${name}-section":
+ context => $context,
+ changes => $ensure ? {
+ present => "set ${target} ${name}",
+ default => "rm ${target} ${name}",
+ },
+ require => Class["samba::server::config"]
+ }
+
+ if $ensure == "present" {
+ augeas { "${name}-comment":
+ context => $context,
+ changes => $description ? {
+ default => "set ${target}/comment ${description}",
+ '' => "rm ${target}/comment",
+ },
+ require => Augeas["${name}-section"],
+ }
+
+ augeas { "${name}-path":
+ context => $context,
+ changes => $path ? {
+ default => "set ${target}/path ${path}",
+ '' => "rm ${target}/path",
+ },
+ require => Augeas["${name}-section"],
+ }
+
+ augeas { "${name}-browsable":
+ context => $context,
+ changes => $browsable ? {
+ default => "set ${target}/browsable ${browsable}",
+ '' => "rm ${target}/browsable",
+ },
+ require => Augeas["${name}-section"],
+ }
+
+ augeas { "${name}-guest_ok":
+ context => $context,
+ changes => $guest_ok ? {
+ default => "set \"${target}/guest ok\" ${guest_ok}",
+ '' => "rm \"${target}/guest ok\"",
+ },
+ require => Augeas["${name}-section"],
+ }
+
+ augeas { "${name}-read_only":
+ context => $context,
+ changes => $read_only ? {
+ default => "set \"${target}/read only\" ${read_only}",
+ '' => "rm \"${target}/read_only\"",
+ },
+ require => Augeas["${name}-section"],
+ }
+ }
+}