On 1/22/2014 7:35 PM, Nathan Nobbe wrote:
>
> I read Craig's article numerous times and have recently published an
> article <
http://quickshiftin.com/blog/2014/01/composition-in-puppet/> on
> my thoughts. To summarize, I feel the big lesson from the article is
> composition is needed to define reusable grouped module declarations
> (aka /roles/). Whether or not you like the notion of the 2-layered
> approach (roles /and/ profiles) is something else and a bit extra IMO.
>
> That said I'm only managing tens of servers rather than hundreds or
> thousands so far, but for me one layer to represent 'roles' has worked
> great.
>
> What it amounts to for me is a simple guideline - leverage inheritance
> (or the hiera hierarchy) as much as possible and introduce composition
> on a need-to basis. Composition is necessary though, unless all your
> systems are identical.
>
> Thanks again Craig for the article. Neat to find you on the google group!
>
> -nathan
If I had the 20-30 hours to write a Puppet Conf presentation it would
be called "The profile is the most important part of role/profile." :-)
In a simple system with a webserver and database, profiles don't appear
to add much. However in a complex system where an Apache server could be
a proxy, app server, ssl terminator, or other function the added layer
is very necessary. In my system I have 25+ roles half of which use
profile::apache to get vastly different configs. In each case
profile::apache provides the entry point for the data Hiera provides
based on Role.
Profile classes are where you get to be opinionated about your config.
In my sample profile::apache class below my Apache module can remain
generic and shareable while profile::apache pulls in things like
collectd, logstash, etc that are specific to how *I* think any server
with Apache should be installed.
You might also check out Craig's later presentation on role profile
which provides a clearer picture than his earlier blog post.
http://www.slideshare.net/PuppetLabs/roles-talk
Ramin
class profile::apache {
include ::apache
include profile::logstash
include profile::sslcerts
collectd::plugin { 'apache': }
logrotate::simple { 'apache':}
$mymods = hiera('apache::a2mods', {})
create_resources('apache::a2mod', $mymods)
$myvhosts = hiera('apache::vhosts', {})
create_resources('apache::vhost', $myvhosts)
Sslcerts::Cert<||> -> Class['apache::service']
}