Google Groups Home
Help | Sign in
Advice on modelling some behaviour
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
ross.mckerc...@sophos.com  
View profile
 More options Jun 27, 11:32 am
From: Ross.McKerc...@sophos.com
Date: Fri, 27 Jun 2008 16:32:42 +0100
Local: Fri, Jun 27 2008 11:32 am
Subject: Advice on modelling some behaviour
Hi Guys,

Having trouble trying to model some behaviour in puppet and would
appreciate some suggestions on how I could achieve it.

I'm trying to write out multiple similar items to a file, think shares in
smb.conf to take one example I'll use throughout (although there's other
places I need to do this aswell).

So the end result I'd like is roughly, to say:

node my-smb-server {
        smb_share{ "myshare":
                path   => "/path/to/share",
                users=> "user1,user2,user3"
        }

}

An extra caveat is that I'd like to be able to define these shares in a
few places. So say, some shares under a node definition and some shares in
an included class (e.g. all servers have one share, but only some servers
have another share).

Then in my ruby template, I'd guess I'd loop over some list, writing out
the config as I go.

So the problems I'm having are:
The naive solutions results in me trying to manage the same file multiple
times, which obviously isn't possible
Trying to bring them all together by, in my resource definition, importing
a class and assigning to a list in that class but fails because 1) I dont
think the +> syntax works for lists and 2) you cant assign to variables in
another class.

I've got a nasty feeling I'm missing a really obvious nice way to do this,
but I just cant get my head round it, hence any advice would be
appreciated. It's really easy for services like apache that allow you to
do "include /etc/.../conf.d" as you can just stick in seperate files but
when you cant I get stuck :)

-ross

--
Ross McKerchar
Systems Analyst, Sophos

Tel: 01235 559933
Web: http://www.sophos.com
Sophos - security and control

Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon,
OX14 3YP, United Kingdom.

Company Reg No 2096520. VAT Reg No GB 348 3873 20.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Al @ Lab42  
View profile
 More options Jun 27, 2:05 pm
From: "Al @ Lab42" <lab42...@gmail.com>
Date: Fri, 27 Jun 2008 11:05:18 -0700 (PDT)
Local: Fri, Jun 27 2008 2:05 pm
Subject: Re: Advice on modelling some behaviour
You may check out David Schmitt's custom functions like concatenated
file or line:
http://git.black.co.at/?p=module-common;a=tree;f=manifests/defines;hb...

Al

Ross.McKerc...@sophos.com ha scritto:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Kanies  
View profile
 More options Jun 30, 5:19 pm
From: Luke Kanies <l...@madstop.com>
Date: Mon, 30 Jun 2008 16:19:22 -0500
Local: Mon, Jun 30 2008 5:19 pm
Subject: Re: [Puppet Users] Advice on modelling some behaviour
On Jun 27, 2008, at 10:32 AM, Ross.McKerc...@sophos.com wrote:

This is a relatively common problem, and people who don't write native  
resource types use a kind of file snippet system -- make a definition  
that writes the appropriate samba config for each share to something  
like /etc/samba.d, then have an exec that combines these into the  
correct configuration file, using 'subscribe' to trigger the exec.

Make sense?

Isn't there one of these published somewhere?

--
The most likely way for the world to be destroyed, most experts agree,
is by accident. That's where we come in; we're computer professionals.
We cause accidents. --Nathaniel Borenstein
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Meier  
View profile
 More options Jun 30, 5:27 pm
From: Peter Meier <peter.me...@immerda.ch>
Date: Mon, 30 Jun 2008 23:27:16 +0200
Local: Mon, Jun 30 2008 5:27 pm
Subject: Re: [Puppet Users] Re: Advice on modelling some behaviour
Hi

> This is a relatively common problem, and people who don't write native  
> resource types use a kind of file snippet system -- make a definition  
> that writes the appropriate samba config for each share to something  
> like /etc/samba.d, then have an exec that combines these into the  
> correct configuration file, using 'subscribe' to trigger the exec.

> Make sense?

> Isn't there one of these published somewhere?

DavidS' common module [1] has something like that integrated.

[1] http://git.black.co.at/?p=module-common;a=summary

greets pete


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ross.mckerc...@sophos.com  
View profile
 More options Jul 23, 4:57 am
From: Ross.McKerc...@sophos.com
Date: Wed, 23 Jul 2008 09:57:00 +0100
Subject: Re: [Puppet Users] Re: Advice on modelling some behaviour
puppet-users@googlegroups.com wrote on 30/06/2008 22:19:22:

Thanks for all the help.

I've checked out David's common module: it can definitely achieve some
(but not all) of what I'm looking for.

The "natural" way that I first tried to model this kind of behaviour is as
follows (please forgive my slightly wacky puppet-pseudocode, hopefully
you'll get the idea):

class a {
        $settings = [a,b]
        file {"/etc/file.conf": content => template('erb file with
content: settings.join(",")') #Contents of file.conf will be out a,b

}

class b inherits a {
        $settings +> [c,d] #Contents of file.conf will be out a,b,c,d

}

Of course this doesn't work - lists are immutable and it appears you
actually have to explicitly duplicate the file definition in all
subclasses to use the assoicated overridden variable.

Is this, or something similar (the above is obv. limited to each "setting"
only having one variable), a sensible feature request? It seems to be
quite a natural thing to be able to do with resorting to any exec-based
black magic.

regards,

-ross

--
Ross McKerchar
Systems Analyst, Sophos

Tel: 01235 559933
Web: http://www.sophos.com
Sophos - security and control

Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon,
OX14 3YP, United Kingdom.

Company Reg No 2096520. VAT Reg No GB 348 3873 20.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google