Book Image

Extending Puppet

By : Alessandro Franceschi
Book Image

Extending Puppet

By: Alessandro Franceschi

Overview of this book

Table of Contents (21 chapters)
Extending Puppet
About the Author
About the Reviewers


Puppet has changed the way we manage our systems. When it was released, other configuration management tools were around, but it was clear that it had something special. It came at the right time with the right approach. The challenges of IT infrastructures were beginning to step up to a new level, and the need to automate common activities such as a quick setup and configuration of systems was becoming a requirement. Puppet presented a sane model, based on abstraction of resources and the definition of the expected state of a system, using a clear and sysadmin-friendly language.

There are various books about Puppet around, and most of them are very good. This one tries to contribute with solid and no frills content (few pictures and few large blocks of copied and pasted text) and some new perspectives and topics. It begins with an intense technical overview of Puppet, Hiera, and PuppetDB so that you can use them to design appropriate Puppet architectures that fit your IT infrastructure.

We will explore where our data can be placed, how to design reusable modules, and how they can be used as building blocks for higher abstraction classes. We will try to give a clearer and wider view of what it means to work with Puppet, and what are the challenges we might face when we introduce it on our systems, from code management to deployment rollouts. We will dive into Puppet's internal details and its extension points, showing the multiple ways we can tweak, extend, and hack with it. We will also give a look to less traditional fields, such as Puppet as a configuration-management tool for network devices or cloud services.

The last chapter is about the future: how Puppet is evolving and what we can expect to do with it in the next years.

I'd dare to say that this is the book I'd have liked to read when I was trying to connect the dots and figure out how to do things in the "right way", struggling to grasp Puppet's inner concepts and reusability patterns.

Years of pain, experience, evolution, and research are poured in these pages and I really hope they can be useful for your personal adventure exploring Puppet.

What this book covers

Chapter 1, Puppet Essentials, is an intense and condensed summary of the most important Puppet concepts: the baseline needed to understand the chapters that follow and a good occasion to refresh and maybe enrich knowledge about the Puppet language and model.

Chapter 2, Hiera, is dedicated to how to manage our data with Hiera: how to define the lookup hierarchy, organize data, and use different backends.

Chapter 3, PuppetDB, covers the installation, configuration, and usage of PuppetDB, and explores the great possibilities that it may enable in the next generations of modules.

Chapter 4, Designing Puppet Architectures, outlines the components to manage when defining a Puppet architecture: the available tools, how to integrate them, how to cope with data and code, and organize resources to be applied to nodes.

Chapter 5, Using and Writing Reusable Modules, covers the most important Puppet element from the user's perspective, modules, and how to write them in order to be able to reuse them in different infrastructures.

Chapter 6, Higher Abstraction Modules, takes a step further and focuses on modules that use different application modules to compose more complex and wider scenarios.

Chapter 7, Deploying and Migrating Puppet, analyzes the approaches that can be taken when introducing Puppet in a new or existing infrastructure: methodologies, patterns, techniques, and tips for a successful deployment.

Chapter 8, Code Workflow Management, focuses on how to manage Puppet code, from when it is written in an editor to its management with an SCM, its testing and deployment to production.

Chapter 9, Scaling Puppet Infrastructures, covers the challenges you might face in growing infrastructures and how it is possible to make Puppet scale with them.

Chapter 10, Writing Puppet Plugins, covers the many available possibilities to extend the core code with custom plugins and gives a deeper view on how Puppet internals are organized.

Chapter 11, Beyond the System, takes a journey outside the traditional territories, exploring how we can manage with Puppet network and storage equipment and cloud instances.

Chapter 12, Future Puppet, is a step towards Puppet 4 and how its new features may influence the way we work with Puppet.

What you need for this book

You can test the Puppet code present in this book on any Linux system connected to the Internet. You can use the Vagrant environment provided in the example code and have your test machines running a VirtualBox instance on your computer. For this, you need both Vagrant and VirtualBox installed on your system.

Who this book is for

This book is accessible to any Puppet user.

If you are totally new to Puppet, be sure to have given a thorough read of Chapter 1, Puppet Essentials, and to have well understood its principles before continuing your reading.

If you are an intermediate user, enjoy reading the following chapters in order.

If you are an advanced user, you may pick in different pages' useful information and new insights on topic you should already know.


In this book you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "For inline documentation about a resource, use the describe subcommand."

A block of code is set as follows:

  - http
  :port: 5984
  :output: json
  :failure: graceful
    - /configuration/%{fqdn}
    - /configuration/%{env}
    - /configuration/common

Any command-line input or output is written as follows:

puppet agent -t
puppet resource package
puppet resource service

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "At the end of a Puppet run, we can have metrics that let us understand how much time the Master spent in compiling and delivering the catalog (Config retrieval time)."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title through the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.


Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.


You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.