JuanBrein
2014-Feb-09 12:47 UTC
[Puppet Users] Roles / profile pattern , inquire on how you handle some specific situations
I've been using puppet on different companies and implementing the roles /
profile pattern on some of them.
In theory the patter works very well but in practice I usually face
challenges that I sort out implementing my own designs / solutions. I would
like to know how you guys deal with that in case you do.
Say you have a typical LAMP stack and you have to deploy a web app so my
classes would look something like this (super simplified version):
*Modules:*
class apache { //puppetlabs class }
class mysql { //puppetlabs class }
etc./.
*Profile*:
class profile::webapp {
class 'apache'
class 'mysql'
$name = hiera('webapp::name')
apache::vhost {$webapp::name:}
}
*Roles:*
class role::prod_web {
include 'base'
include 'profile::webapp'
}
Now some of the questions I face:
1- Say thate for whatever reason the profile::webap requires a specific
package... ie php-apc that is not covered by the apache module. The roles /
profile states that you should always reference modules. Would you guys
create a new class just to include a resource? What I usually end up doing
is to add that package into the profile for the sake of simplicity.
2- Sometimes modules from puppetlabs or other contributors lacks of some
functionality. Say for example you need to deploy a file under
/etc/sysconfig. I wouldn't place that file under the profile class as that
is used for multiple profiles definitions. However creating a new module
for just a single file seams like too much of an overhead. What I usually
do is I split up the profile module into multiple profile modules and use
the repo -> install -> config -> service pattern. That allows me to
create
a file / template where to place my specific resources for that profile and
still consume data from hiera to customize the behaviour.
3- The problem with point 2 is that you might end up with too many profile
classes and some of them might include a simple reference to a module. That
is not much of a problem to me as I prefer to have my files attached to the
right profile module rather than having multiple files on a single profile
module... or multiple modules with just a couple of files.
Cheers!
Juan Breinlinger
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/88ae6576-7407-4b27-a7b4-034e21683d43%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.