Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding share functionality

  • Loading branch information...
commit 112bf940e959bd9ea508ad08b7625b39742efe89 1 parent 0e631dd
Kris Buytaert authored
Showing with 75 additions and 0 deletions.
  1. +21 −0 README
  2. +23 −0 manifests/definitions/shares.pp
  3. +31 −0 templates/smb_share.erb
View
21 README
@@ -12,3 +12,24 @@ $ldap_admin_password
When not using the ldap functionality you use the samba::user defines to create the samba users
+
+
+This module now requires the concat module from
+http://github.com/ripienaar/puppet-concat/
+by R.I.Pienaar
+
+
+This means that one can add additional shares to the smb.conf using
+samba::share as follows
+
+
+ samba::share{"data":
+ name => "data",
+ path => "/srv/storage/",
+ comment => "data",
+ validusers => "me",
+ writelist => "mine",
+ forcegroup => "mine",
+ readonly => "no",
+ createmask => "0766",
+}
View
23 manifests/definitions/shares.pp
@@ -0,0 +1,23 @@
+
+
+define samba::share($name,$path,
+ $guestok='',
+ $writeable='',
+ $comment='',
+ $validusers='',
+ $writelist='',
+ $forcegroup='',
+ $readonly='',
+ $createmask='')
+{
+
+ concat::fragment{$name:
+ target => "/etc/samba/smb.conf",
+ content => template("samba/smb_share.erb"),
+ order => 10,
+
+ }
+
+}
+
+
View
31 templates/smb_share.erb
@@ -0,0 +1,31 @@
+[<%= name %>]
+<%- if !path.empty? -%>
+ path = <%= path %>
+<%- end -%>
+
+<%- if !guestok.empty? -%>
+ guest ok = <%= guestok %>
+<%- end -%>
+<%- if !writeable.empty? -%>
+ writeable = <%= writeable %>
+<%- end -%>
+<%- if !comment.empty? -%>
+ comment = <%= comment %>
+<%- end -%>
+<%- if !validusers.empty? -%>
+ valid users = <%= validusers %>
+<%- end -%>
+<%- if !writelist.empty? -%>
+ write list = <%= writelist %>
+<%- end -%>
+<%- if !forcegroup.empty? -%>
+ force group = <%= forcegroup %>
+<%- end -%>
+<%- if !readonly.empty? -%>
+ read only = <%= readonly %>
+<%- end -%>
+<%- if !createmask.empty? -%>
+ create mask = <%= createmask %>
+<%- end -%>
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.