Using roles and profiles
Well-organized Puppet manifests are easy to read; the purpose of a module should be evident in its name. The purpose of a node should be defined in a single class. This single class should include all classes that are required to perform that purpose. Craig Dunn wrote a post about such a classification system, which he dubbed "roles and profiles" (http://www. craigdunn.org/2012/05/239/). In this model, roles are the single purpose of a node; a node may only have one role, a role may contain more than one profile, and a profile contains all the resources related to a single service. In this example, we will create a web server role that uses several profiles.
How to do it...
We'll create two modules to store our roles and profiles. Roles will contain one or more profiles. Each role or profile will be defined as a subclass, such as profile::base
:
- Decide on a naming strategy for your roles and profiles. In our example, we will create two modules,
roles
andprofiles
, that...