Roles are a way of classifying the different types of services in your infrastructure, as shown in Figure 14-1.
Roles can be used to represent the types of servers in your infrastructure:
Although you can add recipes directly to a node’s run list, that’s not how your infrastructure works. Think about how you normally refer to servers:
Roles allow you to conveniently encapsulate the run lists and attributes required for a server to be what you already think it is. Roles make it easy to configure many nodes identically without repeating yourself each time.
In addition to obvious roles, such as a “web server,” it is common practice to group any functionality that goes together into a role. The most common example is a base role, where you include all the recipes that should be run on every node.
Roles can be created and managed in the same fashion as data bags—there is a directory under chef-playground in which they are organized. The directory name is roles by default.
Use the chef-playground directory you created in Chapter 11. Use the same dual command prompt setup you used there. Start the
chef-zero server on an open port in one window. We will be using port 9501 in the ...