We're building our puppet infrastructure from scratch, and need to
decide on how to organize our modules. As the puppet best practice
document suggests, we're going to put all building blocks modules in
the "modules" area, and make use of the services and clients areas to
make up server configurations.
But how does others build server configurations from these modules in
a dynamic and structured way? How to you handle situations where one
have multiple projects, environments environments (dev, test, qass,
prod), and so forth - do you go for a
"<project>::<environment>::<role>" type of module/class structure?
Before starting to model our servers in the services and clients areas
I'd like to make sure we don't start out wrong.
Best regards,
Kenneth Holter
It was not clear to me exactly how you will be using tags - could you
please elaborate? How will your "clients" and "services" areas be
organized?
Let me briefly mention that we're going to use external nodes to tell
which environment (prod, qass, ...) a node belongs to, and use the
build in puppet enironments to separate code between the environments
(production clients will pull modules from a different module area
than clients in for example qass, and so forth).
- Kenneth
> --
> You received this message because you are subscribed to the Google Groups "Puppet Users" group.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
>
>
The organization of using environments in puppet with module paths
referencing multiple, different working copies of the same version
control repository checked out to different branches works quite well
for many people.
Git is particularly good in this case since it's designed to quickly
switch the working copy among branches quickly and easily. Doing so
in git doesn't result in a different filesystem path which is
convenient when setting the modulepath in each environment.
--
Jeff McCune
http://www.puppetlabs.com/
But structuring the code itself (as was the original topic for this
thread) is of course equally important. We have multiple projects each
consisting of multiple server types/roles and environments (dev, test,
qass, prod), and need our clients and services areas to reflect this
in a dynamic and structured way. Having a base/generic class like
Christian proposed is the way to go, but I would like to hear from
others how they have organized the clients and services areas.
- Kenneth
> On other words, my clients area would look something like this:
> • "c_projectA", in which the classes "c_projectA::prod::webserver", "c_projectA::qass::webserver" and so forth would be implemented (and added to the node definition for the relevant servers)
> • "c_projectB", in which the classes "c_projectB::dev::database", "c_projectB::testing::database" and so forth would be implemented (and added to the node definition for the relevant servers)
> • etc
> I haven't thought out all the details yet, but I believe something like this would make having multiple server setups manageable. Any thoughts on this kind of setup?
>
This seems like it would lead to a confusing multiplicity of manifests.
Unless (in your example) webservers are completely divergent and have nothing in common between qass and prod environments, I'd put all the webserver code in one class and use decision-making conditionals inside the class to change aspects of the resources. That way when someone else comes along and wants to modify webserver behaviour they have only one place to look instead of four or five. You're starting out with an external node tool, so setting variables at top-level scope for projects and environments will make this easy. I've ended up with a common structure among the different modules: typically there's a case statement at the top which sets class-scope variables based on the globals everyone on the team knows about and uses, then the actual resources below which use those class-scope vars inline. EG:
class infrastructure::sudoers {
case $env { # globally set by external node tool
dev,qa,perf: {
$sudoersfile = "sudoers.preprod"
}
prod: {
$sudoersfile = "sudoers.prod"
}
default: { # always make a safe default in case $env is unset
$sudoersfile = "sudoers.minimal"
}
}
file { "sudoers":
path => $operatingsystem ? {
solaris => "/usr/local/etc/sudoers",
default => "/etc/sudoers",
},
owner => "root",
group => 0,
mode => "0440",
source => "puppet:///external/sudo/$sudoersfile",
}
}
Does that make sense? Not sure if the use-case maps up exactly to yours but it sounds close enough that this might work for you and end up being a lot simpler.
- Eric Sorenson - N37 17.255 W121 55.738 - http://twitter.com/ahpook -
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.