Hi all, I''ve been turning my head upside down to find a solution on the following problem: I have a samba fileserver and need to make puppet do: 1. Create groups 2. Create directories with group rights 3. Create an smb-shares.conf from a template that can be included in the main smb.conf. To do this I need to have a combination of sharename and group _and_ create the smb-shares.conf from the template. And I can''t figure out how to do it? As I can see it, I need a way to specify a list like: $shares = [ "adminshare:admingroup", "documents:users" ] but I can''t do that, can I? Does anyone have a suggestion...? -- Med venlig hilsen Juri Rischel Jensen Fab:IT ApS Vesterbrogade 50 DK-1620 København Tlf: 70 202 407 / Fax: 33 313 640 www.fab-it.dk / juri@fab-it.dk
Why not using definitions for the Samba shares? Each definition could create a file for the share in /etc/samba/share.d/ for example and you use an "include" statement in your main samba configuration file. You can also use puppet notification to restart/reload the Samba service. 2007/8/23, Juri Rischel Jensen <juri@fab-it.dk>:> Hi all, > > I''ve been turning my head upside down to find a solution on the > following problem: > > I have a samba fileserver and need to make puppet do: > > 1. Create groups > 2. Create directories with group rights > 3. Create an smb-shares.conf from a template that can be included in > the main smb.conf. > > To do this I need to have a combination of sharename and group _and_ > create the smb-shares.conf from the template. And I can''t figure out > how to do it? > > As I can see it, I need a way to specify a list like: > > $shares = [ "adminshare:admingroup", "documents:users" ] > > but I can''t do that, can I? > > Does anyone have a suggestion...? > > > -- > Med venlig hilsen > Juri Rischel Jensen > > Fab:IT ApS > Vesterbrogade 50 > DK-1620 København > Tlf: 70 202 407 / Fax: 33 313 640 > www.fab-it.dk / juri@fab-it.dk > > > > > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >
On Aug 23, 2007, at 17:24, Sébastien Prud''homme wrote:> Each definition could create a file for the share in > /etc/samba/share.d/ for example and you use an "include" statement in > your main samba configuration file.Ahh, it was my impression that you couldn''t use wildcards or direcories in the include line in smb.conf. If I can do that, it''ll be a h*ll of a lot easier. Thanks! -- Med venlig hilsen Juri Rischel Jensen Fab:IT ApS Vesterbrogade 50 DK-1620 København Tlf: 70 202 407 / Fax: 33 313 640 www.fab-it.dk / juri@fab-it.dk
On Aug 23, 2007, at 11:03 AM, Juri Rischel Jensen wrote:> Ahh, it was my impression that you couldn''t use wildcards or > direcories in the include line in smb.conf. If I can do that, it''ll > be a h*ll of a lot easier. Thanks!In those cases where you can''t, you can use the ''file snippet'' pattern to cat a bunch of files together and create your complete configuration. -- Charm is a way of getting the answer yes without asking a clear question. -- Albert Camus --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
HARRIS Jimmy \(AXA-Tech-AU\)
2007-Aug-23 23:55 UTC
Re: Using resource names in templates...
> I have a samba fileserver and need to make puppet do: > > 1. Create groups > 2. Create directories with group rights > 3. Create an smb-shares.conf from a template that can be included in > the main smb.conf. > > To do this I need to have a combination of sharename and group _and_ > create the smb-shares.conf from the template. And I can''t figure out > how to do it? > > As I can see it, I need a way to specify a list like: > > $shares = [ "adminshare:admingroup", "documents:users" ] > > but I can''t do that, can I? > > Does anyone have a suggestion...?This is how I use Puppet to manage my Samba shares. It doesn''t completely cover what you want to do, but it might give you some ideas. In modules/samba/manifests/init.pp: define samba::server ($active="false", $shares="") { package { "samba": ensure => installed } service { "smb": enable => $active, ensure => $active, hasstatus => true, hasrestart => true, } file { "/etc/samba/includes/": ensure => directory, recurse => true, purge => true, notify => Service["smb"], } file { "/etc/samba/smb.conf": content => template("samba/smb.conf.erb"), group => "root", owner => "root", mode => "0644", notify => Service["smb"], } case $shares { "": {} # No shares so do nothing default: { samba::server::shares { $shares: } } } } define samba::server::shares { file { "/etc/samba/includes/$name.smb.conf": content => template("samba/$name.smb.conf.erb"), purge => true, owner => root, group => root, mode => 0644, notify => Service["smb"], } } My smb.conf template includes: <% shares.each do |share| -%> include = /etc/samba/includes/<%= share %>.smb.conf <% end -%> This ensures that only the shares that are defined are included. Purging of the includes directory now seems to be working so I could probably just replace it with include = /etc/samba/includes/* but there''s no harm in leaving it as is. An example of one of the share configuration template files: # # A public read-only share for Weblogic content. # [<%= name %>] comment = <%= fqdn %> - Weblogic content path = /home/teamsite/dmsBase public = yes writable = no I then use a class like below to create the appropriate shares: class weblogic-samba-shares { import "samba" samba::server { "weblogic-samba-shares": active => true, shares => ["dmsbase", "bealogs", "viewstg"], } } Hope this helps, James ********************************************************************************* Important Note This email (including any attachments) contains information which is confidential and may be subject to legal privilege. If you are not the intended recipient you must not use, distribute or copy this email. If you have received this email in error please notify the sender immediately and delete this email. Any views expressed in this email are not necessarily the views of AXA-Tech Australia. Thank you. **********************************************************************************
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 24 August 2007, HARRIS Jimmy (AXA-Tech-AU) wrote:> > I have a samba fileserver and need to make puppet do: > > > > 1. Create groups > > 2. Create directories with group rights > > 3. Create an smb-shares.conf from a template that can be included in > > the main smb.conf. > > > > To do this I need to have a combination of sharename and group _and_ > > create the smb-shares.conf from the template. And I can''t figure out > > how to do it? > > > > As I can see it, I need a way to specify a list like: > > > > $shares = [ "adminshare:admingroup", "documents:users" ] > > > > but I can''t do that, can I? > > > > Does anyone have a suggestion...? > > This is how I use Puppet to manage my Samba shares. It doesn''t > completely cover what you want to do, but it might give you some ideas. > > In modules/samba/manifests/init.pp: > > define samba::server ($active="false", $shares="") { > package { "samba": > ensure => installed > } > > service { "smb": > enable => $active, > ensure => $active, > hasstatus => true, > hasrestart => true, > } > > file { "/etc/samba/includes/": > ensure => directory, > recurse => true, > purge => true, > notify => Service["smb"], > } > > file { "/etc/samba/smb.conf": > content => template("samba/smb.conf.erb"), > group => "root", > owner => "root", > mode => "0644", > notify => Service["smb"], > } > > case $shares { > "": {} # No shares so do nothing > default: { > samba::server::shares { $shares: } > } > } > } > > define samba::server::shares { > file { "/etc/samba/includes/$name.smb.conf": > content => template("samba/$name.smb.conf.erb"), > purge => true, > owner => root, > group => root, > mode => 0644, > notify => Service["smb"], > } > } > > My smb.conf template includes: > > <% shares.each do |share| -%> > include = /etc/samba/includes/<%= share %>.smb.conf > <% end -%> > > This ensures that only the shares that are defined are included. > Purging of the includes directory now seems to be working so I could > probably just replace it with include = /etc/samba/includes/* but > there''s no harm in leaving it as is. > > An example of one of the share configuration template files: > > # > # A public read-only share for Weblogic content. > # > [<%= name %>] > comment = <%= fqdn %> - Weblogic content > path = /home/teamsite/dmsBase > public = yes > writable = no > > I then use a class like below to create the appropriate shares: > > class weblogic-samba-shares { > import "samba" > samba::server { "weblogic-samba-shares": > active => true, > shares => ["dmsbase", "bealogs", "viewstg"], > } > } > > Hope this helps, > > James > > *************************************************************************** >****** Important Note > This email (including any attachments) contains information which is > confidential and may be subject to legal privilege. If you are not > the intended recipient you must not use, distribute or copy this > email. If you have received this email in error please notify the > sender immediately and delete this email. Any views expressed in this > email are not necessarily the views of AXA-Tech Australia. Thank you. > *************************************************************************** >*******Hi James, Would you be intereseted to publish your samba manifest under a more permissive license than your default legalese? I''m collecting puppet modules in my git repository at http://git.black.co.at/ or git://git.black.co.at/manifests/ Regards, David - -- The primary freedom of open source is not the freedom from cost, but the free- dom to shape software to do what you want. This freedom is /never/ exercised without cost, but is available /at all/ only by accepting the very different costs associated with open source, costs not in money, but in time and effort. - -- http://www.schierer.org/~luke/log/20070710-1129/on-forks-and-forking -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFG0ejB/Pp1N6Uzh0URArbLAJ4gGEab9+Gt4Kata3ljZIcHOenJDgCcCPRg v/B1yb916WjLQnuwjThWs+w=fS8O -----END PGP SIGNATURE-----
On Aug 26, 2007, at 3:55 PM, David Schmitt wrote:> Would you be intereseted to publish your samba manifest under a more > permissive license than your default legalese? I''m collecting > puppet modules > in my git repository at http://git.black.co.at/ or > git://git.black.co.at/manifests/I''ve also been working on actually getting a modules-sharing site up and running, but it''s (unsurprisingly) going more slowly than I''d hoped. I''ve got everything except user management in place (well, technically, Rick''s doing all the work). In the meantime, I can easily pull down any git repos that people have and then set up a cron job to just update them once a night. I''ve set up a modules site to point to them: http://modules.reductivelabs.com/ It''s basically nothing but a pointer to plain git repos at this point. Hopefully I''ll set up gitweb at some point, I guess. If people send me the path to a git repo they''d like me to duplicate there, along with an optional description, I''ll add it to the list, and then when I can bring up a more complete site I''ll port them over. -- If all the world''s a stage, I want to operate the trap door. -- Paul Beatty --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
HARRIS Jimmy \(AXA-Tech-AU\)
2007-Aug-28 00:02 UTC
Re: Using resource names in templates...
> Would you be intereseted to publish your samba manifest under a more > permissive license than your default legalese? I''m collecting puppetmodules> in my git repository at http://git.black.co.at/ or > git://git.black.co.at/manifests/Yes, certainly, and I have several more modules that may be of interest. Is there a standard license that people are using or recommending? James ********************************************************************************* Important Note This email (including any attachments) contains information which is confidential and may be subject to legal privilege. If you are not the intended recipient you must not use, distribute or copy this email. If you have received this email in error please notify the sender immediately and delete this email. Any views expressed in this email are not necessarily the views of AXA-Tech Australia. Thank you. **********************************************************************************
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 28 August 2007, HARRIS Jimmy (AXA-Tech-AU) wrote:> > Would you be intereseted to publish your samba manifest under a more > > permissive license than your default legalese? I''m collecting puppet > > modules > > > in my git repository at http://git.black.co.at/ or > > git://git.black.co.at/manifests/ > > Yes, certainly, and I have several more modules that may be of interest. > Is there a standard license that people are using or recommending? >I''ve licensed all modules under a BSD license, since I do not believe that in a service-oriented[1] environment the copyleft properties of the GPL do not out-weigh the reduced flexibility. I know of others who do not share this opinion. Regards, David [1] in contrast to product-oriented - -- The primary freedom of open source is not the freedom from cost, but the free- dom to shape software to do what you want. This freedom is /never/ exercised without cost, but is available /at all/ only by accepting the very different costs associated with open source, costs not in money, but in time and effort. - -- http://www.schierer.org/~luke/log/20070710-1129/on-forks-and-forking -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFG0+Vy/Pp1N6Uzh0URAtbGAJ9q5G4nJdusErkN1nImLO1pzK/ZkACfeI5X +EZS2Uthwa+h+o+FHNNnx3I=L5hK -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 28 August 2007, Luke Kanies wrote:> On Aug 26, 2007, at 3:55 PM, David Schmitt wrote: > > Would you be intereseted to publish your samba manifest under a more > > permissive license than your default legalese? I''m collecting > > puppet modules > > in my git repository at http://git.black.co.at/ or > > git://git.black.co.at/manifests/ > > I''ve also been working on actually getting a modules-sharing site up > and running, but it''s (unsurprisingly) going more slowly than I''d > hoped. I''ve got everything except user management in place (well, > technically, Rick''s doing all the work). > > In the meantime, I can easily pull down any git repos that people > have and then set up a cron job to just update them once a night. > > I''ve set up a modules site to point to them: > > http://modules.reductivelabs.com/ > > It''s basically nothing but a pointer to plain git repos at this point. > > Hopefully I''ll set up gitweb at some point, I guess. > > If people send me the path to a git repo they''d like me to duplicate > there, along with an optional description, I''ll add it to the list, > and then when I can bring up a more complete site I''ll port them over.Great, thanks Luke! git://git.black.co.at/manifests/ """A snapshot of David Schmitt''s manifests and modules. They are in development for managing a virtual hosting offer, firewalls and auxiliary systems. Current list of modules: * apache * apt * backuppc * common - various little tools * dbp - hodgepodge of common debian configurations * dovecot - the imap/pop server * ejabberd * exim4 - spam/virus scanning configuration * git - git repository and gitweb configuration * hosting - pulls everything together * ldap - manage users with smbldap-tools * mailman * munin - automatically monitors all munin::clients * ntp - setup a local NTP subnet * samba * shorewall * ssh - distribute host keys * ssmtp * virtual - manage linux-vserver and xen Additionally, there are some un-modularized classes: * bind - DNS Zone management * david - a default user * firewall - dnsmasq and hardware management * leshaper - a straight-forward traffic shaper * logcheck * modules - manage kernel modules * mysql * nagios - collect service checks from all puppets * slimfit - reduce installation footprint for debian Some of those contain site-specific information and are not immediately usable, but most should be a good foundation for managing the respective aspect. Refactoring and extension patches very welcome.""" License: BSD Homepage: http://www.edv-bus.at/ Author: David Schmitt <david at schmitt.edv-bus.at> Regards, David - -- The primary freedom of open source is not the freedom from cost, but the free- dom to shape software to do what you want. This freedom is /never/ exercised without cost, but is available /at all/ only by accepting the very different costs associated with open source, costs not in money, but in time and effort. - -- http://www.schierer.org/~luke/log/20070710-1129/on-forks-and-forking -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFG0+oA/Pp1N6Uzh0URApjPAJ46n5gOyy35rSeoHp1mt9E3MD+A0wCfQeCD rliXaRWo8EKpcMbtO3pTppo=apa6 -----END PGP SIGNATURE-----
On Aug 28, 2007, at 4:25 AM, David Schmitt wrote:> git://git.black.co.at/manifests/I''ll pull this down as ''david'' for now, but it''s be great if you could break each of these modules into separate git repositories, to make it easier for people to just pull down the modules they want. I know that a lot of your modules are inter-dependent, but the right solution is to have good documentation with each module and then eventually to support some kind of dependency system. When I get the modules application working, it''ll have some standards where you''d have a README file or something in restructured text that would get turned into the module''s html description, and then you''d have a DEPENDENCIES file or something that declared what other modules were required. Then the next step would be to modify prm so that it can pull down these modules and easily update them. Also, I think the descriptions (as git expects them in the ''description'' file) should be one line, although I haven''t really found any clear indication one way or another other than that a few commands use the description in things like commit emails. -- The easiest way to figure the cost of living is to take your income and add ten percent. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com