Puppet 3 Cookbook

Puppet 3 Cookbook
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
save 6%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • 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, 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


Book Details

Language : English
Paperback : 274 pages [ 235mm x 191mm ]
Release Date : August 2013
ISBN : 1782169768
ISBN 13 : 9781782169765
Author(s) : John Arundel
Topics and Technologies : All Books, Networking and Servers, Cookbooks, Open Source

Table of Contents

Chapter 1: Puppet Infrastructure
Chapter 2: Puppet Language and Style
Chapter 3: Writing Better Manifests
Chapter 4: Working with Files and Packages
Chapter 5: Users and Virtual Resources
Chapter 6: Applications
Chapter 7: Servers and Cloud Infrastructure
Chapter 8: External Tools and the Puppet Ecosystem
Chapter 9: Monitoring, Reporting, and Troubleshooting
  • Chapter 1: Puppet Infrastructure
    • Introduction
    • Installing Puppet
    • Creating a manifest
    • Managing your manifests with Git
    • Creating a decentralized Puppet architecture
    • Writing a papply script
    • Running Puppet from cron
    • Deploying changes with Rake
    • Bootstrapping Puppet with Rake
    • Automatic syntax checking with Git hooks
    • Chapter 2: Puppet Language and Style
      • Introduction
      • Using community Puppet style
      • Checking your manifests with puppet-lint
      • Using modules
      • Using standard naming conventions
      • Using inline templates
      • Iterating over multiple items
      • Writing powerful conditional statements
      • Using regular expressions in if statements
      • Using selectors and case statements
      • Using the in operator
      • Using regular expression substitutions
      • Chapter 3: Writing Better Manifests
        • Introduction
        • Using arrays of resources
        • Using definitions
        • Using dependencies
        • Using tags
        • Using run stages
        • Using node inheritance
        • Passing parameters to classes
        • Using class inheritance and overriding
        • Writing reusable, cross-platform manifests
        • Getting information about the environment
        • Importing dynamic information
        • Passing arguments to shell commands
        • Chapter 4: Working with Files and Packages
          • Introduction
          • Making quick edits to config files
          • Using Augeas to automatically edit config files
          • Building config files using snippets
          • Using ERB templates
          • Using array iteration in templates
          • Using GnuPG to encrypt secrets
          • Installing packages from a third-party repository
          • Building packages automatically from source
          • Comparing package versions
          • Chapter 5: Users and Virtual Resources
            • Introduction
            • Using virtual resources
            • Managing users with virtual resources
            • Managing users' SSH access
            • Managing users' customization files
            • Efficiently distributing cron jobs
            • Using schedules to limit when resources can be applied
            • Using host resources
            • Using multiple file sources
            • Distributing directory trees
            • Cleaning up old files
            • Auditing resources
            • Temporarily disabling resources
            • Chapter 6: Applications
              • Introduction
              • Managing Apache servers
              • Creating Apache virtual hosts
              • Creating Nginx virtual hosts
              • Managing MySQL
              • Managing Ruby
              • Chapter 7: Servers and Cloud Infrastructure
                • Introduction
                • Building high-availability services using Heartbeat
                • Managing NFS servers and file shares
                • Using HAProxy to load-balance multiple web servers
                • Managing firewalls with iptables
                • Managing EC2 instances
                • Managing virtual machines with Vagrant
                • Chapter 8: External Tools and the Puppet Ecosystem
                  • Introduction
                  • Creating custom facts
                  • Adding external facts
                  • Setting facts as environment variables
                  • Importing configuration data with Hiera
                  • Storing secret data with hiera-gpg
                  • Generating manifests with puppet resource
                  • Generating manifests with other tools
                  • Testing your manifests with rspec-puppet
                  • Using public modules
                  • Using an external node classifier
                  • Creating your own resource types
                  • Creating your own providers
                  • Creating your own functions
                  • Chapter 9: Monitoring, Reporting, and Troubleshooting
                    • Introduction
                    • Doing a dry run
                    • Logging command output
                    • Logging debug messages
                    • Generating reports
                    • Producing automatic HTML documentation
                    • Drawing dependency graphs
                    • Understanding Puppet errors
                    • Inspecting configuration settings

                    John Arundel

                    John Arundel is a devops consultant, which means he solves difficult problems for a living. (He doesn't get called in for easy problems.) He has worked in the tech industry for 20 years, and during that time has done wrong (or seen done wrong) almost everything that you can do wrong with computers. That comprehensive knowledge of what not to do, he feels, is one of his greatest assets as a consultant. He is still adding to it. He likes writing books, especially about Puppet (The Puppet 3 Beginner's Guide is available from the same publisher). It seems that at least some people enjoy reading them. He also provides training and coaching on Puppet, which it turns out is far harder than simply doing the work himself. Off the clock, he can usually be found driving a Land Rover up some mountain or other. He lives in a small cottage in Cornwall and believes, like Cicero, that if you have a garden and a library, then you have everything you need. You can follow him on Twitter at @bitfield.
                    Sorry, we don't have any reviews for this title yet.

                    Code Downloads

                    Download the code and support files for this book.

                    Submit Errata

                    Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                    - 4 submitted: last submission 08 May 2014

                    Errata type: Technical | Page number: 20

                    The recipe "Running Puppet from cron" in Chapter 1, Puppet Infrastructure:

                    Step 2 of the instructions in the "How to do it" section reads:
                    2. Keep the private key file somewhere separate from your Puppet repo (you'll distribute this via some other channel to machines which need to check out the repo).

                    This should actually read:
                    2. Move the private key file into your puppet module:
                    ubuntu@cookbook:~/puppet$ mv ubuntu modules/puppet/files/ubuntu.priv


                    Errata type: Technical | Page number: 17 and 18

                    The recipe "Writing a papply script" in Chapter 1, Puppet Infrastructure:

                    In the "How it works" section on page 17 (once) and 18 (twice):

                    "puppet apply manifests/nodes.pp" should be "puppet apply manifests/sites.pp".

                    Errata type: Code | Page number: 20 and 22

                    In the "How to do it..." section,

                    ensure => 'present'

                    should be

                    ensure => present

                    Errata type: Technical | Page no: 54

                    The IPv4 address should be a class C address instead of class A (

                    A better example address would be Though it makes no difference for the purposes of the demonstration.


                    Sample chapters

                    You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                    Frequently bought together

                    Puppet 3 Cookbook +    Haskell Data Analysis Cookbook =
                    50% Off
                    the second eBook
                    Price for both: $41.55

                    Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                    What you will learn from this book

                    • Installing and setting up Puppet for the first time
                    • Producing eye-catching reports and information for management
                    • Understanding common error messages and troubleshooting common problems
                    • Managing large networks
                    • Taking control of configuration data with Hiera and encrypting secrets with GnuPG
                    • Producing reliable, clean, maintainable code to community standards with puppet-lint and rspec-puppet
                    • Using classes and inheritance to write powerful Puppet code
                    • Deploying configuration files and templates for lightning-fast installations
                    • Using virtual machines to build test and staging environments, and production systems on cloud platforms such as EC2
                    • Automating every aspect of your systems including provisioning, deployment and change management
                    • Making Puppet reliable, performant, and scalable

                    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. You’ll be introduced to powerful tools that work with Puppet such as Hiera. The book also explains managing Ruby applications and MySQL databases, building web servers, load balancers, high-availability systems with Heartbeat, and many other state-of-the-art techniques


                    "Puppet 3 Cookbook" is written in a Cookbook style, showing you how to set up and expand your Puppet infrastructure. It not only gives you everything you need to become a Puppet expert, but includes powerful code samples and techniques developed over many years of production experience. With it, you’ll save time and effort by automating tedious manual processes, impress your boss by delivering better business value from IT, and future-proof your career by getting to grips with the new technologies revolutionizing the industry.

                    Who this book is for

                    "Puppet 3 Cookbook" is for anyone who builds and administers servers, especially in a web operations context. It requires some experience of Linux systems administration, including familiarity with the command line, file system, and text editing. No programming experience is required.

                    Code Download and Errata
                    Packt Anytime, Anywhere
                    Register Books
                    Print Upgrades
                    eBook Downloads
                    Video Support
                    Contact Us
                    Awards Voting Nominations Previous Winners
                    Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                    Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software