Book Image

Mastering Puppet

By : Thomas Uphill
Book Image

Mastering Puppet

By: Thomas Uphill

Overview of this book

Table of Contents (17 chapters)

Preface

Every project changes when you scale it out. Puppet is no different. Working on a small number of nodes with a small team of developers is a completely different task than working with thousands of nodes with a large group of developers.

Mastering Puppet deals with the issues faced with larger deployments, such as scaling and duplicate resource definitions. It will show you how to fit Puppet into your organization and keep everyone working. The concepts presented can be adopted to suit organizations of any size.

What this book covers

Chapter 1, Dealing with Load/Scale, deals with scaling out your Puppet infrastructure to handle a large number of nodes. Using proxying techniques, a sample deployment is presented.

Chapter 2, Organizing Your Nodes and Data, is where we examine different methods of applying modules to nodes. In addition to ENCs (external node classifiers), we use hiera and hiera_include to apply modules to nodes.

Chapter 3, Git and Environments, shows you how to use Git hooks to deploy your code to your Puppet masters and enforce access control for your modules.

Chapter 4, Public Modules, presents several supported modules from the Puppet Forge and has real-world example use cases.

Chapter 5, Custom Facts and Modules, is all about extending facter with custom facts and rolling your own modules to solve problems.

Chapter 6, Custom Types, covers how to implement defined types and create your own custom types where appropriate.

Chapter 7, Reporting and Orchestration, says that without reporting you'll never know when everything is broken. We explore two popular options for reporting, Foreman and Puppet Dashboard. We then configure and use the marionette collective (mcollective or mco) to perform orchestration tasks.

Chapter 8, Exported Resources, is an advanced topic where we have resource definitions on one node applying to another node. We start by configuring puppetdb and more onto real-world exported resources examples with Forge modules.

Chapter 9, Roles and Profiles, is a popular design paradigm used by many large installations. We show how this design can be implemented using all of the knowledge from the previous chapters.

Chapter 10, Troubleshooting, is a necessity. Things will always break, and we will always need to fix them. This chapter shows some common techniques for troubleshooting.

What you need for this book

All the examples in this book were written and tested using an Enterprise Linux 6.5 derived installation such as CentOS 6.5, Scientific Linux 6.5, or Springdale Linux 6.5. Additional repositories used were EPEL (Extra Packages for Enterprise Linux), the Software Collections (SCL) Repository, the Foreman repository, and Puppet Labs repository. The version of Puppet used was the latest 3.4 series at the time of writing.

Who this book is for

This book is for system administrators and Puppeteers writing Puppet code in an enterprise setting. Puppet masters will appreciate the scaling and troubleshooting chapters and Puppet implementers will find useful tips in the customization chapters.

Conventions

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.

Puppet code words in text, module names, folder names, filenames, dummy URLs, and user input are shown as follows: "The file /var/lib/puppet/classes.txt contains a list of the classes applied to the machine."

A block of code is set as follows:

class base {
  file {'one':
    path   => '/tmp/one',
    ensure => 'directory',
  }
  file {"two":
    path   => "/tmp/one$one",
    ensure => 'file',
  }
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

service {'nginx':
  require => Package['nginx'],
  ensure  => true,
  enable  => true,
}

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

$ mco ping
worker1.example.com                      time=86.03 ms
node2.example.com                        time=96.21 ms
node1.example.com                        time=97.64 ms
---- ping statistics ----
3 replies max: 97.64 min: 86.03 avg: 93.29

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: "Then navigate to the settings section and update the trusted_puppetmaster_hosts setting."

Note

Warnings or important notes appear in a box like this.

Tip

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 via 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 www.packtpub.com/authors.

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 http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

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 http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata is verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

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.

Questions

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.