Thomas,
Consider the following:
node 'linux_machine', 'mac_machine' {
class { "mail": }
}
class mail {
if ($operatingsystem == 'MacOSX') {
class { "mail::mac": }
} elsif ($operatingsystem == 'RedHat') {
class { "mail::rhel": }
}
}
At a high level, all your machines are configured for mail. Look deeper
and you find a split on operating system, a class for each inside the
'mail' module. You don't have to worry about OS differences at the node
level, you just want mail configured.
Also there must be *some* similarities between a linux machine's email
setup and a mac's. Don't they have the same upstream SMTP server? Here
you saved writing the same piece of information down twice:
class mail::params {
$company_smtp_server = 'smtp.example.com'
}
class mail::mac inherits mail::params {
...
}
class mail::rhel inherits mail::params {
...
}
HTH,
-Luke
On 03/05/12 17:39, Thomas A. Fine wrote:
Hi,
I'm new to Puppet, and I'm trying to wrap my head around how I should
organize things. It seems pretty clear that the intent is to organize
things around functional facilities, like ntp, printing, name
resolution, etc. But my original inclination was to organize things
more organizationally for instance, common configs, mac configs, linux
configs, etc.
But it seems that it doesn't make much sense to have a module called
"common" because it wouldn't really do anything except contain other
modules. And after reading the best practices, it looks like maybe
the templates.pp is the place to sort of group things in this way.
On the other hand, I'm not loving the functional organization, because
(for example) mail configs for a mac have absolutely nothing in common
with mail configs for a linux system. I know I could have one piece
of code that says "if this is a mac, change these files, if it's
linux, change these instead". And I see the advantage in doing that
in terms of being able to parameterize the few bits that actually are
in common, like the name of our smtp server.
But to me it feels like it would be better to have separate code for
mac and linux, partly because they share so little code. And partly
because two different people are responsible for these two platforms,
and shouldn't be stepping on each others toes. And to extend that
thought it would be nice if a mistake screwed up only one platform
instead of all platforms. And this is made more confusing by the fact
that this is true only for some functional units; other things would
be similar or identical across platforms.
So do I shut up and write modules that handle multiple platforms? Or
is there a way to get both functional and organizational separation at
the same time and have the best of both worlds? It has occurred to me
that I could have (for example) an emailclient module, and then have
emailclient::darwin etc. and have emailclient include the appropriate
module subclass... but this makes me wonder if I'm misunderstanding
the point here as it seems like I'm calling an extension of a class
from the class itself which seems recursive or incorrect somehow.
Sorry for the long-winded explanation of my confusion. Any help is
appreciated.
tom
--
Luke Bigum
Information Systems
Ph: +44 (0) 20 3192 2520
[email protected] | http://www.lmax.com
LMAX, Yellow Building, 1A Nicholas Road, London W11 4AN
FX and CFDs are leveraged products that can result in losses exceeding
your deposit. They are not suitable for everyone so please ensure you
fully understand the risks involved. The information in this email is not
directed at residents of the United States of America or any other
jurisdiction where trading in CFDs and/or FX is restricted or prohibited
by local laws or regulations.
The information in this email and any attachment is confidential and is
intended only for the named recipient(s). The email may not be disclosed
or used by any person other than the addressee, nor may it be copied in
any way. If you are not the intended recipient please notify the sender
immediately and delete any copies of this message. Any unauthorised
copying, disclosure or distribution of the material in this e-mail is
strictly forbidden.
LMAX operates a multilateral trading facility. Authorised and regulated
by the Financial Services Authority (firm registration number 509778) and
is registered in England and Wales (number 06505809).
Our registered address is Yellow Building, 1A Nicholas Road, London, W11
4AN.
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.