Whopper Tacos

Ops, Security, Efficiency

My Technique for Reconciling Generic Canned Puppet Modules and Organization-specific Configurations

| Comments

As I’ve mentioned before I use a large set of cross-platform, relatively generic modules that I wrote for a system I call GRUMPS. The problem with this method is that you’re going to need to have some ERBs and files that are custom to your organization.

In my previous post about using Puppet submodules, you may have noticed that in addition to my grumps-modules, I use an organization-modules as the second module in my modulepath. So, to remediate the need for site- specific stuff while maintaining the generic moduleset is to create modules under the organization-modules directory named modulename_priv.

Then I do something like this to tell my defined resources to look there (the …’s cut out code not necessary for this demonstration):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
define httpd::site (
   $ensure  = "present",
   $group   = "${httpd::apache_group}",
   $mode    = "640",
   $owner   = "root",
   $private = "false"
) {
...

   if ($private == "true") {
      $template_path = "httpd_priv/sites/${name}.erb"
   } else {
      $template_path = "httpd/sites/${name}.erb"
   }

...

   file {
      "${httpd::confdir}/${name}":
         content  => $ensure ? { present => template($template_path), absent => undef },
         ensure   => $ensure,
         group    => $group,
         mode     => $mode,
         owner    => $owner,
         tag      => "httpd_config";
   }

Comments