Book Image

Puppet 5 Cookbook - Fourth Edition

By : Thomas Uphill
Book Image

Puppet 5 Cookbook - Fourth Edition

By: Thomas Uphill

Overview of this book

Puppet is a configuration management system that automates all your IT configurations, giving you control of managing each node. Puppet 5 Cookbook will take you through Puppet's latest and most advanced features, including Docker containers, Hiera, and AWS Cloud Orchestration. Updated with the latest advancements and best practices, this book delves into various aspects of writing good Puppet code, which includes using Puppet community style, checking your manifests with puppet-lint, and learning community best practices with an emphasis on real-world implementation. You will learn to set up, install, and create your first manifests with version control, and also learn about various sysadmin tasks, including managing configuration files, using Augeas, and generating files from snippets and templates. As the book progresses, you'll explore virtual resources and use Puppet's resource scheduling and auditing features. In the concluding chapters, you'll walk through managing applications and writing your own resource types, providers, and external node classifiers. By the end of this book, you will have learned to report, log, and debug your system.
Table of Contents (16 chapters)
Title Page
Packt Upsell
Contributors
Preface
Index

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:

  1. Decide on a naming strategy for your roles and profiles. In our example, we will create two modules, roles and profiles, that...