Book Image

Puppet Essentials

By : Felix Frank
Book Image

Puppet Essentials

By: Felix Frank

Overview of this book

<p>With this book, you'll be up and running with using Puppet to manage your IT systems. Dive right in with basic commands so that you can use Puppet right away, and then blitz through a series of illustrative examples to get to grips with all the most important aspects and features of Puppet.</p> <p>Install Puppet, write your first manifests, and then immediately put the Puppet tools to real work. Puppet Essentials reveals the innovative structure and approach of Puppet through step-by-step instructions to follow powerful use cases. Learn common troubleshooting techniques and the master/agent setup as well as the building blocks for advanced functions and topics that push Puppet to the limit, including classes and defined types, modules, resources, and leveraging the flexibility and expressive power implemented by Facter and the Hiera toolchain. Finally, send Puppet to the skies with practical guidance on how to use Puppet to manage a whole application cloud.</p>
Table of Contents (16 chapters)
Puppet Essentials
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

The software industry is changing and so are its related fields. Old paradigms are slowly giving way to new roles and shifting views on what the different professions should bring to the table. The DevOps trend pervades evermore workflows. Developers set up and maintain their own environments, and operations raise automation to new levels and translate whole infrastructures to code.

A steady stream of new technologies allows for more efficient organizational principles. One of these newcomers is Puppet. Its fresh take on server configuration management caused rapid adoption and distribution throughout the industry. In the few years of its existence, Puppet has managed to rally thousands of users who employ it in numerous contexts to achieve manifold results. While it is not the only configuration management system available, it is certainly the most widespread by now.

From its specialized language to the system that makes it work, Puppet has innovated and rapidly conquered the software industry. Its extendible structure, paired with a large and helpful community, has made Puppet a powerhouse of easy configuration. The more well known a software is, the greater the chance that Puppet will deploy and configure it out of the box.

Puppet's own learning curve is not sharp, and the available documentation is not only extensive, but also of high quality. Nevertheless, even experienced programmers and administrators can face difficulties at some point. Advanced use might require the navigation of some intricacies that stem from Puppet's unique modeling approach.

This book aims at teaching you all that is required to tap not only the basics of Puppet, but also the very ideas and principles of Puppet-based designs. Sophisticated tooling is presented in order to enable efficient and productive use. You are introduced to and familiarized with a range of Puppet-centric technologies.

What this book covers

Chapter 1, Writing Your First Manifests, gives you an introduction to the core concepts of Puppet, including a syntax tutorial. You will learn how to write and use Puppet manifests within a few pages.

Chapter 2, The Master and Its Agents, provides you with a quick how-to guide in order to set up all the components required for a distributed Puppet infrastructure. It will teach you how to create the master, an agent, and set up Passenger with Apache or Nginx.

Chapter 3, A Peek Under the Hood – Facts, Types, and Providers, gives you a summary of the core components that give Puppet its flexibility as well as its ease of use and extension. It will help you understand the principles of Puppet's function.

Chapter 4, Modularizing Manifests with Classes and Defined Types, teaches you the most important structural elements of Puppet manifests. You will learn how to use them for best results.

Chapter 5, Extending Your Puppet Infrastructure with Modules, gives you a tour of downloadable extensions along with providing you with a guide to create your own. You will learn how to extend Puppet for your specific needs.

Chapter 6, Leveraging the Full Toolset of the Language, teaches you how to interpret and use language features beyond the basics.

Chapter 7, Separating Data from Code Using Hiera, provides you with an introduction to the powerful configuration data storage that comes with Puppet. You will learn how to naturally model your infrastructure in a hierarchy.

Chapter 8, Configuring Your Cloud Application with Puppet, gives you a superposition of the skills you have acquired. It will help you gain some specialized insights into how to take centralized control of your cloud through Puppet.

What you need for this book

To follow the examples, it is sufficient to use a computer with enough resources to run two or more virtual machine instances. The virtualization guests should have a connection to the Internet and with each other. The configuration examples are tailored to the Debian GNU/Linux operating system in Version 7 with the code name "Wheezy".

Who this book is for

This book assumes that you have no prior Puppet knowledge. You should have a sound technical background. Experience with the GNU/Linux command line is required. Existing programming skills are recommended. This book is also suitable for beginners or intermediate Puppet users who wish to expand their knowledge about the software.

Conventions

In this book, you will find a number of text styles 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: "If you do this, Puppet will include the full path to the newly created .dot file in its output."

A block of code is set as follows:

digraph Resource_Cycles { 
  label = "Resource Cycles" 
"File[/etc/haproxy/haproxy.cfg]" -> "Service[haproxy]" -> "File[/etc/haproxy]" -> "File[/etc/haproxy/haproxy.cfg]" 
}

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

package { 
    $apache_package: 
        ensure => 'installed' 
}

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

root@puppet# puppet cert clean agent 
Info: Caching certificate for agent 
Notice: Revoked certificate with serial 18 
Notice: Removing file Puppet::SSL::Certificate agent at '/var/lib/puppet/ssl/ca/signed/agent.pem' 
Notice: Removing file Puppet::SSL::Certificate agent at '/var/lib/puppet/ssl/certs/agent.pem' 

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "It's safer to click on the Project URL link near the top of the module description."

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 disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in 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 at 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 from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. 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 could 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 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.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted 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

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.