Puppet 3 Cookbook

Puppet 3 Cookbook

John Arundel

Language: English

Pages: 274

ISBN: 1782169768

Format: PDF / Kindle (mobi) / ePub

Build reliable, scalable, secure, and high-performance systems to fully utilize the power of cloud computing


  • Use Puppet 3 to take control of your servers and desktops, with detailed step-by-step instructions
  • Covers all the popular tools and frameworks used with Puppet: Dashboard, Foreman, MCollective, and more
  • Teaches you how to extend Puppet with custom functions, types, and providers
  • Packed with tips and inspiring ideas for using Puppet to automate server builds, deployments, and workflows

In Detail

A revolution is happening in web operations. Configuration management tools can build servers in seconds, and automate your entire network. Tools like Puppet are essential to taking full advantage of the power of cloud computing, and building reliable, scalable, secure, high-performance systems. More and more systems administration and IT jobs require some knowledge of configuration management, and specifically Puppet.

"Puppet 3 Cookbook" takes you beyond the basics to explore the full power of Puppet, showing you in detail how to tackle a variety of real-world problems and applications. At every step it shows you exactly what commands you need to type, and includes full code samples for every recipe.

The book takes the reader from a basic knowledge of Puppet to a complete and expert understanding of Puppet’s latest and most advanced features, community best practices, writing great manifests, scaling and performance, and extending Puppet by adding your own providers and resources. It starts with guidance on how to set up and expand your Puppet infrastructure, then progresses through detailed information on the language and features, external tools, reporting, monitoring, and troubleshooting, and concludes with many specific recipes for managing popular applications.

The book includes real examples from production systems and techniques that are in use in some of the world’s largest Puppet installations, including a distributed Puppet architecture based on the Git version control system. It covers common problems and errors and shows you how to troubleshoot your Puppet manifests. You’ll be introduced to powerful tools that work with Puppet such as Hiera and MCollective. You’ll learn how to use objection orientation and classes to write powerful, reusable manifests, and how to embed Ruby code in templates. You’ll find out how to extend Puppet with custom resource types and providers. The book also explains managing Rails applications and databases, building web servers, load balancers, high-availability systems with Heartbeat, and many other state-of-the-art techniques.

What you will learn from this book

  • Install and set up Puppet for the first time
  • Manage large networks with tools like Foreman and MCollective
  • Take control of configuration data with Hiera and encrypting secrets with GnuPG
  • Produce reliable, clean, maintainable code to community standards with puppet-lint and rspec-puppet
  • Use classes and inheritance to write powerful Puppet code
  • Deploy configuration files and templates for lightning-fast installations
  • Use virtual machines to build test and staging environments, and production systems on cloud platforms such as EC2
  • Automate every aspect of your systems including provisioning, deployment, and change management

OpenStack Operations Guide: Set Up and Manage Your OpenStack Cloud

Building SANs with Brocade Fabric Switches

CWDP Certified Wireless Design Professional Official Study Guide (Exam PW0-250)

Learning Unix for OS X: Going Deep with the Terminal and Shell (2nd Edition)
















of tools to do this, including ff Arrays ff Definitions ff Dependencies ff Inheritance ff Class parameters We'll see how to use all of these and more. As you read through the chapter, try out the examples, and look through your own manifests to see where these features might help you simplify and improve your Puppet code. Using arrays of resources Anything you can do to a resource, you can do to an array of resources. Use this idea to refactor your manifests to make them shorter and

'me_last': stage => 'last', } Note that in the class declarations for me_first and me_last we didn't have to specify that they take a stage parameter. stage is a metaparameter, which means it can be applied to any class or resource without having to be explicitly declared. There's more… You can define as many run stages as you like, and set up any ordering for them. This can greatly simplify a complicated manifest which otherwise would require lots of explicit dependencies between resources.

this is a very large drink. If the template is used in a context where the variable $name contains Zaphod Beeblebrox, the template will evaluate to: Zaphod Beeblebrox, this is a very large drink. This simple technique is very useful for generating lots of files which only differ in the values of one or two variables, for example, virtual hosts, and for inserting values into a script such as database names and passwords. How to do it… In this example, we'll use an ERB template to insert a

following steps: 1. Download the source tarball 2. Unpack the tarball 3. Configure and build the program 4. Install the program 106 Chapter 4 How to do it… In this example we'll build the popular load testing tool Httperf (there's no need to do this for production, as there's a distro package available in Ubuntu, but it's a pretty straightforward example of a source install): 1. Modify your manifests/nodes.pp file as follows: node 'cookbook' { exec { 'install-httperf': cwd => '/root',

interface will show you how your backend servers are performing, how many sessions they are handling, whether HAProxy has marked them up or down, and so on. 177 Servers and Cloud Infrastructure There's more… If you want to add more backends to handle the increased demand, just add more server lines to haproxy.cfg. If you find that the existing servers are getting swamped, try decreasing the per-server maxconn setting a little. HAProxy has a vast range of configuration parameters which you can

Download sample