Summary
In this chapter, we've looked at a range of different ways of organizing your Puppet code. We've covered classes in detail, explaining how to define them using the class
keyword to define a new class, using the include
keyword to declare the class, and using Hiera's automatic parameter lookup mechanism to supply parameters for included classes.
Declaring parameters involves specifying the allowable data types for parameters, and we've had a brief overview of Puppet's data types, including scalars, collections, content types and range parameters, abstract types, flexible types, and introduced creating your own type aliases. We've also introduced the defined resource type, and explained the difference between defined resource types and classes, and when you would use one or the other.
We've also looked at how to use the classes
array in Hiera to include common classes on all nodes, and other classes only on particular nodes. We've introduced the...