On 12/20/2013 7:24 AM, Josh wrote:
Ramin,

Thanks.  Your description was very helpful. I have finally started to
understand how everything should be organized.

My profile::apache class needs to drop some additional templates/files
to the host for my Apache configuration.  Where should these files and
templates be located?  For example, is it frowned upon to create a
"files" or "templates" sub-directory under profiles?  Example?

profiles/files/apache/apachestats.conf
profiles/templates/apache/apachestats.erb

This particular file/template should be associated directly with Apache,
but I don't know if it warrants creating an entirely new module just to
house one or two files.

That's a gray area in my experience. On my system I maintain an internal Apache module. Because I don't share it or care about using the more mainstream puppetlabs-apache module I push a number of local changes down into the Apache module. This makes the most sense for me because I want Apache to fully work with *my* stats collection, monitoring, etc out of the box. That said my module predates role/profile. If I were starting over, I'd probably write a more general Apache module and push the site specific files into the profile. That class might look something like this.

class profile::apache {
  include ::apache
  include sslcerts

  collectd::plugin { 'apache': }
  logrotate::simple { 'apache': }
  nrpe::simple { 'check_apache': }

  $myconfs = hiera('apache::conf', {})
  create_resources('apache::conf', $myconfs)
  $mymods = hiera('apache::a2mods', {})
  create_resources('apache::a2mod', $mymods)
  $myvhosts = hiera('apache::vhosts', {})
  create_resources('apache::vhost', $myvhosts)

  Sslcerts::Cert<||> -> Service['apache']
}

Your template question is a bit harder and is again something on a gray area in my experience. I like to put vhosts in modules/$mycompany/templates/apache/ rather than directly in the Apache module. However I do manage status.conf, logging.conf, ports.conf etc out of the Apache module and all files reside within. Again if I were doing it over I might make general templates and pass them data via a hiera lookups in profile::apache. Those templates would live in the Apache module and I think that's the right place for them. However I'm running a single system within a single business unit. Flexibility to support many use cases often takes a back seat to the quickest way forward which is why most of my conf files aren't even templates. Easy to get away with hardcoding everything when you own the full stack.

In summary role, profile, and module aren't so easy to define as we'd like. The organization of the business, the system, and the way you admin the system are all factors in how you ultimately decide to organize your Puppet code and data.

Ramin

--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/52B4768F.6010301%40badapple.net.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to