You are previewing Puppet 2.7 Cookbook.
O'Reilly logo
Puppet 2.7 Cookbook

Book Description

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

  • Shows you how to use 100 powerful advanced features of Puppet, with detailed step-by-step instructions

  • Covers all the popular tools and frameworks used with Puppet: Dashboard, Foreman, MCollective, and more

  • Includes the latest features and updates in Puppet 2.7

  • Written in a simple, practical style by a professional systems administrator and Puppet expert, every recipe has detailed step-by-step instructions showing you the exact commands and configuration settings you need

  • In Detail

    A revolution is coming to IT operations. Configuration management tools can build servers in seconds, and automate your entire network. Tools like Puppet are essential to take full advantage of the power of cloud computing, and build reliable, scalable, secure, high-performance systems.

    The book 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 how to extend Puppet by adding your own providers and resources.

    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 and a high-performance Puppetmaster solution using Apache and Passenger.

    Explore the power of Puppet with this practical guide to the world’s most popular configuration management system

    Table of Contents

    1. Puppet 2.7 Cookbook
      1. Puppet 2.7 Cookbook
      2. Credits
      3. About the Author
      4. About the Reviewers
      5. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      6. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      7. 1. Puppet Infrastructure
        1. Using version control
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        2. Using commit hooks
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        3. Deploying changes with Rake
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Configuring Puppet's file server
          1. How to do it...
            1. How it works...
            2. There's more...
            3. See also
          2. Running Puppet from cron
            1. How to do it...
            2. How it works...
            3. There's more...
            4. See also
          3. Using autosign
            1. How to do it...
            2. How it works...
            3. See also
          4. Pre-signing certificates
            1. How to do it...
            2. See also
          5. Retrieving files from Puppet's filebucket
            1. How to do it...
            2. How it works...
            3. There's more...
          6. Scaling Puppet using Passenger
            1. Getting ready
            2. How to do it...
            3. How it works...
            4. There's more...
            5. See also
        5. Creating decentralized Puppet architecture
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      8. 2. Monitoring, Reporting, and Troubleshooting
        1. Generating reports
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Enabling reports on the command line
            2. Logging Puppet messages to syslog
          4. See also
        2. E-mailing log messages containing specific tags
          1. How to do it...
            1. How it works...
            2. There's more...
              1. What are tags?
              2. Specifying multiple tags, or excluding tags
              3. Sending reports to multiple e-mail addresses
            3. See also
        3. Creating graphical reports
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Producing automatic HTML documentation
          1. How to do it...
          2. How it works...
          3. There's more...
        5. Drawing dependency graphs
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
        6. Testing your Puppet manifests
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        7. Doing a dry run
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        8. Detecting compilation errors
          1. How to do it...
          2. How it works...
        9. Understanding Puppet errors
          1. How to do it...
        10. Logging command output
          1. How to do it...
          2. How it works...
          3. There's more...
        11. Logging debug messages
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Printing out variable values
            2. Printing the full resource path
            3. Logging messages on the Puppetmaster
        12. Inspecting configuration settings
          1. How to do it...
          2. How it works...
        13. Using tags
          1. How to do it...
          2. There's more...
        14. Using run stages
          1. How to do it...
          2. How it works...
          3. There's more...
        15. Using environments
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
      9. 3. Puppet Language and Style
        1. Using community Puppet style
          1. How to do it...
          2. There's more...
        2. Using modules
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Templates
            2. Facts, functions, types, and providers
            3. puppet-module
            4. Third-party modules
            5. Module organization
          4. See also
        3. Using standard naming conventions
          1. How to do it...
          2. There's more...
        4. Using embedded Ruby
          1. How to do it...
          2. How it works...
          3. See also
        5. Writing manifests in pure Ruby
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Variables
            2. Documentation
        6. Iterating over multiple items
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Hashes
            2. Creating arrays with the split function
        7. Writing powerful conditional statements
          1. How to do it...
          2. How it works...
          3. There's more...
            1. elsif
            2. Comparisons
            3. Combining expressions
          4. See also
        8. Using regular expressions in if statements
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Capturing patterns
            2. Regular expression syntax
          4. See also
        9. Using selectors and case statements
          1. How to do it...
            1. How it works...
            2. There's more...
              1. Regular expressions
              2. Defaults
        10. Testing whether values are contained in strings
          1. How to do it...
          2. There's more...
        11. Using regular expression substitutions
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
      10. 4. Writing Better Manifests
        1. Using arrays of resources
          1. How to do it...
            1. How it works...
            2. See also
        2. Using define resources
          1. How to do it...
          2. How it works...
          3. There's more...
        3. Using dependencies
          1. How to do it...
          2. How it works...
          3. There's more...
        4. Using node inheritance
          1. How to do it...
            1. How it works...
            2. There's more...
            3. See also
        5. Using class inheritance and overriding
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Undefining parameters
            2. Adding extra values using the +> operator
            3. Disabling resources
          5. See also
        6. Passing parameters to classes
          1. How to do it...
            1. How it works...
            2. There's more...
            3. See also
        7. Writing reusable, cross-platform manifests
          1. How to do it...
            1. How it works...
            2. There's more...
            3. See also
        8. Getting information about the environment
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        9. Importing dynamic information
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Importing data from CSV files
          1. Getting ready...
            1. How to do it...
            2. How it works...
            3. There's more...
            4. See also
        11. Passing arguments to shell commands
          1. How to do it...
          2. How it works...
      11. 5. Working with Files and Packages
        1. Making quick edits to config files
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        2. Using Augeas to automatically edit config files
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
        3. Building config files using snippets
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        4. Using ERB templates
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        5. Using array iteration in templates
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        6. Installing packages from a third-party repository
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        7. Setting up an APT package repository
          1. Getting ready...
          2. How to do it...
          3. How it works...
            1. There's more...
              1. Adding packages
              2. Configuring nodes to use the repository
              3. Signing your packages
        8. Setting up a gem repository
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Adding gems
            2. Using the gem repo
        9. Building packages automatically from source
          1. How to do it...
          2. How it works...
            1. There's more...
        10. Comparing package versions
          1. How to do it...
          2. How it works...
      12. 6. Users and Virtual Resources
        1. Using virtual resources
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        2. Managing users with virtual resources
          1. How to do it...
          2. How it works...
          3. See also
        3. Managing users' SSH access
          1. How to do it...
          2. How it works...
          3. There's more...
        4. Managing users' customization files
          1. How to do it...
          2. How it works...
          3. See also
        5. Efficiently distributing cron jobs
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        6. Running a command when a file is updated
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
        7. Using host resources
          1. How to do it...
          2. How it works...
          3. There's more...
        8. Using multiple file sources
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        9. Distributing directory trees
          1. How to do it...
          2. How it works...
          3. There's more...
        10. Cleaning up old files
          1. How to do it...
          2. How it works...
          3. There's more...
        11. Using schedules with resources
          1. How to do it...
          2. How it works...
          3. There's more...
        12. Auditing resources
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        13. Temporarily disabling resources
          1. How to do it...
          2. How it works...
        14. Managing timezones
          1. How to do it...
          2. There's more...
      13. 7. Applications
        1. Managing Apache servers
          1. How to do it...
          2. There's more...
        2. Creating Apache virtual hosts
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        3. Creating Nginx virtual hosts
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Creating MySQL databases and users
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Managing Drupal sites
          1. Getting ready...
            1. How to do it...
            2. How it works...
            3. There's more...
        6. Managing Rails applications
          1. How to do it...
          2. How it works...
            1. Nginx and Passenger
            2. Rails
          3. There's more...
            1. RVM
            2. Log rotation
            3. Databases
            4. SSL certificates
      14. 8. Servers and Cloud Infrastructure
        1. Deploying a Nagios monitoring server
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
        2. Building high-availability services using Heartbeat
          1. How to do it...
            1. How it works...
            2. There's more...
        3. Managing NFS servers and file shares
          1. How to do it...
          2. How it works...
          3. There's more...
        4. Using HAProxy to load-balance multiple web servers
          1. How to do it...
          2. How it works...
          3. There's more...
        5. Managing firewalls with iptables
          1. Getting ready...
          2. How to do it...
            1. How it works...
            2. There's more...
        6. Managing EC2 instances
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Managing virtual machines with Vagrant
          1. How to do it...
          2. How it works...
          3. There's more...
      15. 9. External Tools and the Puppet Ecosystem
        1. Creating custom Facter facts
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
        2. Executing commands before and after Puppet runs
          1. How to do it...
          2. There's more...
        3. Generating manifests from shell sessions
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Generating manifests from a running system
          1. How to do it...
          2. There's more...
        5. Using Puppet Dashboard
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Using Foreman
          1. Getting ready...
          2. How to do it...
          3. There's more...
        7. Using MCollective
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Installing an MCollective plugin
        8. Using public modules
          1. Getting ready...
          2. How to do it...
          3. How it works...
          4. There's more...
        9. Using an external node classifier
          1. Getting ready...
            1. How to do it...
            2. How it works...
            3. There's more...
        10. Creating your own resource types
          1. Getting ready...
          2. How to do it...
            1. How it works...
            2. There's more...
              1. Documentation
              2. Validation
        11. Creating your own providers
          1. Getting ready...
            1. How to do it...
            2. How it works...
            3. There's more...