Chapter 9. Roles and Profiles

In Chapter 2, Organizing Your Nodes and Data, we showed you how to organize your nodes using an ENC or Hiera, or ideally both. At that point, we didn't cover the Forge modules or writing your own modules, as we did in Chapter 4, Public Modules, and Chapter 5, Custom Facts and Modules. In this chapter, we will cover a popular design concept employed in large installations of Puppet. The idea was originally made popular by Craig Dunn in his blog, which can be found at http://www.craigdunn.org/2012/05/239/. Garry Larizza also wrote a useful post on the subject at http://garylarizza.com/blog/2014/02/17/puppet-workflow-part-2/.

Design pattern

The concept put forth by Craig Dunn in his blog is the one at which most Puppet masters arrive independently. Modules should be nested in such a way that common components can be shared among nodes. The naming convention that is generally accepted is that roles contain one or more profiles. Profiles in turn contain one or more modules. You can have a node-level logic that is very clean and elegant using the roles and profile design patterns, together with an ENC and Hiera,. The ENC and/or Hiera can also be used to enforce standards on your nodes without interfering with the roles and profiles. As we discussed in Chapter 2, Organizing Your Nodes and Data, with the virtual module it is possible to have Hiera apply classes automatically to any system where the is_virtual fact is true. Applying the same logic to facts such as osfamily, we can ensure that all the nodes for which osfamily is RedHat, receive an appropriate module.

Putting all these elements together, we arrive at the following diagram showing how modules are applied to a node:

Design pattern

Roles are the high-level abstraction of what a node will do.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.50.60