0%

Book Description

Pro Puppet is an in-depth guide to installing, using, and developing the popular configuration management tool Puppet. The book is a comprehensive follow-up to the previous title Pulling Strings with Puppet. Puppet provides a way to automate everything from user management to server configuration. You'll learn how to create Puppet recipes, extend Puppet, and use Facter to gather configuration data from your servers.

Puppet is a must-have tool for system administrators, and Pro Puppet will teach you how to maximize its capabilities and customize it for your environment.

  • Install and configure Puppet to immediately start automating tasks and create reporting solutions

  • Learn insider tricks and techniques to better manage your infrastructure

  • Become a Puppet expert!

What you'll learn

  • See how to install Puppet on a variety of platforms

  • Learn how to manage infrastructure with Puppet

  • Discover how to scale Puppet to suit small, medium, and large organizations

  • Learn how to integrate Puppet with other tools such as Cucumber and Nagios

  • Discover advanced Puppet techniques to make managing your environment easier

  • Learn how to develop and extend Puppet to suit your environment

Who this book is for

Systems administrators, implementers and systems integrators.

Table of Contents

  1. Copyright
  2. About the Authors
  3. About the Technical Reviewer
  4. Acknowledgments
  5. Introduction
  6. 1. Getting Started with Puppet
    1. 1.1. What Is Puppet?
      1. 1.1.1. Deployment
      2. 1.1.2. Configuration Language and Resource Abstraction Layer
        1. 1.1.2.1. Configuration Language
        2. 1.1.2.2. Resource Abstraction Layer
      3. 1.1.3. Transactional Layer
    2. 1.2. Selecting the Right Version of Puppet
    3. 1.3. Can I mix releases of Puppet?
    4. 1.4. Installing Puppet
      1. 1.4.1. Installing on Red Hat Enterprise Linux and Fedora
      2. 1.4.2. Installing on Debian and Ubuntu
      3. 1.4.3. Installing on OpenSolaris
      4. 1.4.4. Installing from Source
      5. 1.4.5. Installing on Microsoft Windows
      6. 1.4.6. Installing on other Platforms
    5. 1.5. Configuring Puppet
      1. 1.5.1. The site.pp file
      2. 1.5.2. Firewall Configuration
      3. 1.5.3. Starting the Puppet Master
    6. 1.6. Connecting Our First Agent
      1. 1.6.1. Completing the Connection
    7. 1.7. Creating Our First Configuration
      1. 1.7.1. Extending the site.pp file
      2. 1.7.2. Agent Configuration
    8. 1.8. Creating our first module
      1. 1.8.1. Module Structure
      2. 1.8.2. The init.pp file
    9. 1.9. Applying Our First Configuration
    10. 1.10. Summary
    11. 1.11. Resources
  7. 2. Building Hosts with Puppet
    1. 2.1. Getting Started
      1. 2.1.1. Installing Puppet
      2. 2.1.2. Configuring Nodes
        1. 2.1.2.1. Working With Similar Hosts
        2. 2.1.2.2. Using External Sources
        3. 2.1.2.3. Specifying a Default Node
        4. 2.1.2.4. Node Inheritance Structure
          1. 2.1.2.4.1. Variable Scoping
    2. 2.2. Making (More) Magic With Modules
      1. 2.2.1. Version Controlling Your Modules
    3. 2.3. Creating a module to Manage SSH
      1. 2.3.1. Managing Our Classes
        1. 2.3.1.1. The ssh::install Class
        2. 2.3.1.2. The ssh::config Class
        3. 2.3.1.3. The ssh::service Class
    4. 2.4. Creating a Module to Manage Postfix
      1. 2.4.1. The postfix::install class
      2. 2.4.2. The postfix::config class
      3. 2.4.3. The postfix::service class
    5. 2.5. Managing MySQL with the mysql Module
      1. 2.5.1. The mysql::install class
      2. 2.5.2. The mysql::config class
      3. 2.5.3. The mysql::service class
    6. 2.6. Managing Apache and Websites
      1. 2.6.1. The apache::install class
      2. 2.6.2. The apache::service class
      3. 2.6.3. The Apache definition
    7. 2.7. Managing Puppet with the Puppet Module
    8. 2.8. Summary
    9. 2.9. Resources
  8. 3. Working with Environments
    1. 3.1. Configuring Puppet Environments
      1. 3.1.1. Populating the New Environments
        1. 3.1.1.1. Creating a Clone
      2. 3.1.2. Making Changes to the Development Environment
    2. 3.2. Testing the New Environments with the Puppet Agent
    3. 3.3. Environment Branching and Merging
      1. 3.3.1. Setting Up a Central Repository
        1. 3.3.1.1. Creating a Bare Repository for the Modules
        2. 3.3.1.2. Making Individual Changes
      2. 3.3.2. Developing a Change Using a Branch
        1. 3.3.2.1. Making Changes to the sshd Configuration File
        2. 3.3.2.2. Testing the Puppet Agent Against the sshd Configuration File
        3. 3.3.2.3. Making Changes to the Postfix Configuration File
        4. 3.3.2.4. Testing the Puppet Agent Against the Postfix Configuration File
      3. 3.3.3. Merging Changes into a Testing Environment
        1. 3.3.3.1. Creating the Testing Branch
        2. 3.3.3.2. Merging the Changes into the Development Branch
        3. 3.3.3.3. Merging into the Testing Branch
        4. 3.3.3.4. Performing Checkout on the Testing Branch
        5. 3.3.3.5. Testing the Changes
    4. 3.4. Production Environment Releases
    5. 3.5. Summary
    6. 3.6. Resources
  9. 4. Puppet Scalability
    1. 4.1. Identifying the Challenges
    2. 4.2. Running the Puppet Master with Apache and Passenger
      1. 4.2.1. Installing Apache and Passenger on Enterprise Linux
      2. 4.2.2. Installing Apache and Passenger on Debian-Based Systems
      3. 4.2.3. Installing Passenger Using Ruby Gems
      4. 4.2.4. Configuring Apache and Passenger
      5. 4.2.5. Testing the Puppet Master in Apache
    3. 4.3. Load-Balancing Multiple Puppet Masters
      1. 4.3.1. HTTP Load Balancing
        1. 4.3.1.1. Puppet Master Worker Configuration
        2. 4.3.1.2. Front End Load Balancer Configuration
        3. 4.3.1.3. Testing the Load Balancer Configuration
      2. 4.3.2. Puppet CA Load Balancing Configuration
        1. 4.3.2.1. Puppet CA Worker Configuration
        2. 4.3.2.2. Synchronizing the Hot Standby Puppet CA Directory
        3. 4.3.2.3. Puppet CA Hot Standby
        4. 4.3.2.4. Primary Puppet CA Fail Back
    4. 4.4. Measuring Performance
      1. 4.4.1. Splay Time
    5. 4.5. Summary
    6. 4.6. Resources
  10. 5. Externalizing Puppet Configuration
    1. 5.1. External Node Classification
      1. 5.1.1. Configuring Nodes Using An External Node Classifier
      2. 5.1.2. An External Node Classifier in a Shell Script
      3. 5.1.3. A Ruby External Node Classifier
      4. 5.1.4. A Perl External Node Classifier
      5. 5.1.5. Back-Ending a Node Classification
    2. 5.2. Storing Node Configuration in LDAP
      1. 5.2.1. Installing Ruby LDAP Libraries
      2. 5.2.2. Setting Up the LDAP Server
      3. 5.2.3. Adding the Puppet Schema
      4. 5.2.4. Configuring LDAP in Puppet
    3. 5.3. Summary
    4. 5.4. Resources
  11. 6. Exporting and Storing Configuration
    1. 6.1. Virtual Resources
      1. 6.1.1. Declaring and Realizing a Virtual Resource
      2. 6.1.2. Applying the Realize Function
      3. 6.1.3. Making Virtual Resources Real
      4. 6.1.4. Relationship-Chaining Syntax
    2. 6.2. Getting Started with Exported and Stored Configurations
      1. 6.2.1. The Stored Configuration Database Server
        1. 6.2.1.1. Installing Packages on Enterprise Linux-Based Systems
        2. 6.2.1.2. Installing Packages on Debian and Ubuntu
        3. 6.2.1.3. Installing Rails Using Gems
      2. 6.2.2. Configuring Puppet Master for Stored Configuration
      3. 6.2.3. Adding a MySQL Table Index
    3. 6.3. Using Exported Resources
      1. 6.3.1. Automated SSH Public Host Key Management
      2. 6.3.2. Exporting Load Balancer Worker Resources
      3. 6.3.3. Automating Nagios Service Checks
    4. 6.4. Scaling Stored Configurations
      1. 6.4.1. Thin Stored Configurations
      2. 6.4.2. Queue Support for Stored Configurations
      3. 6.4.3. Installing ActiveMQ on Enterprise Linux-Based Systems
      4. 6.4.4. Installing ActiveMQ on Debian-Based Systems
      5. 6.4.5. Puppet Master Queue Configuration
    5. 6.5. Expiring Stale Resources
    6. 6.6. Summary
    7. 6.7. Resources
  12. 7. Puppet Consoles: Puppet Dashboard and The Foreman
    1. 7.1. Puppet Dashboard
      1. 7.1.1. Installing Puppet Dashboard
        1. 7.1.1.1. Installing the Red Hat Prerequisites
        2. 7.1.1.2. Installing the Ubuntu Prerequisites
        3. 7.1.1.3. Installing the Dashboard Package
          1. 7.1.1.3.1. RPM Packages via Yum
          2. 7.1.1.3.2. DEB Packages via APT
          3. 7.1.1.3.3. Installing from Source
      2. 7.1.2. Configuring the Dashboard
      3. 7.1.3. Running Puppet Dashboard
        1. 7.1.3.1. Running Puppet Dashboard with Webrick
        2. 7.1.3.2. Running Puppet Dashboard with Passenger
          1. 7.1.3.2.1. Installing Prerequisite Packages
          2. 7.1.3.2.2. Configure an Apache Virtual Host
      4. 7.1.4. Integrating Puppet Dashboard
        1. 7.1.4.1. Importing Existing Reports
        2. 7.1.4.2. Live Report Aggregation
          1. 7.1.4.2.1. Puppet 2.6.0 and later
          2. 7.1.4.2.2. Puppet 0.25.x and earlier
        3. 7.1.4.3. Viewing Reports
      5. 7.1.5. External Node Classification
      6. 7.1.6. Logging, Database Backup and Performance
    2. 7.2. The Foreman
      1. 7.2.1. Installing Foreman
        1. 7.2.1.1. Installing Foreman via RPM
        2. 7.2.1.2. Installing via DEB
      2. 7.2.2. Configuring Foreman
        1. 7.2.2.1. Configuring Foreman on Red Hat
        2. 7.2.2.2. Configuring Foreman on Ubuntu and Debian
        3. 7.2.2.3. Managing Foreman's Database
        4. 7.2.2.4. Importing Data from Puppet
      3. 7.2.3. Starting Foreman
      4. 7.2.4. Integrating Foreman's Capabilities
        1. 7.2.4.1. Using Foreman as an ENC
      5. 7.2.5. Displaying Reports in Foreman
      6. 7.2.6. Displaying Nodes Information in Foreman
      7. 7.2.7. Using Foreman to trigger Puppet
    3. 7.3. Summary
    4. 7.4. Resources
  13. 8. Tools and Integration
    1. 8.1. Puppet Forge and Module Tool
      1. 8.1.1. Installing the Puppet Module Tool
      2. 8.1.2. Searching and Installing a Module from the Forge
      3. 8.1.3. Using a Module
      4. 8.1.4. Creating a Module with the Puppet-Module Tool
        1. 8.1.4.1. Managing Modules with Git
        2. 8.1.4.2. Managing Platform-Specific Resources
        3. 8.1.4.3. Building and Testing a Puppet Module
        4. 8.1.4.4. Adding Enterprise Linux Support to the NTP Module
        5. 8.1.4.5. Releasing the NTP Module to the Forge
    2. 8.2. Puppet Ruby DSL
      1. 8.2.1. The Problem: Resources from Data
      2. 8.2.2. Declaring Resources from Data
        1. 8.2.2.1. A Small Puppet Module Using the Ruby DSL
        2. 8.2.2.2. Testing the Ruby DSL
        3. 8.2.2.3. Account Information from an ENC
        4. 8.2.2.4. Accounts Ruby DSL Module
        5. 8.2.2.5. Testing the Ruby DSL Accounts Module
    3. 8.3. Cucumber Puppet
      1. 8.3.1. Installing Cucumber Puppet
      2. 8.3.2. Writing a Story
      3. 8.3.3. Testing the Basic Catalog Policy
        1. 8.3.3.1. Testing the failure case
      4. 8.3.4. Validating Specific Resources
        1. 8.3.4.1. Adding a Check Step to the Policy
        2. 8.3.4.2. Implementing the Cucumber Check
        3. 8.3.4.3. Catching Changes in the ENC Data
    4. 8.4. Summary
    5. 8.5. Resources
  14. 9. Reporting with Puppet
    1. 9.1. Getting Started
    2. 9.2. Configuring Reporting
    3. 9.3. Report Processors
      1. 9.3.1. log
      2. 9.3.2. tagmail
      3. 9.3.3. rrdgraph
      4. 9.3.4. http
    4. 9.4. Custom Reporting
    5. 9.5. Summary
    6. 9.6. Resources
  15. 10. Extending Facter and Puppet
    1. 10.1. Writing and Distributing Custom Facts
      1. 10.1.1. Configuring Puppet for Custom Facts
      2. 10.1.2. Writing Custom Facts
      3. 10.1.3. Testing the Facts
    2. 10.2. Developing Custom Types, Providers and Functions
      1. 10.2.1. Configuring Puppet for Types, Providers and Functions
      2. 10.2.2. Writing a Puppet Type and Provider
        1. 10.2.2.1. Creating Our Type
        2. 10.2.2.2. Creating the Subversion Provider
        3. 10.2.2.3. Using Your New Type
      3. 10.2.3. Writing a Parsed File Type and Provider
        1. 10.2.3.1. The Shells Type
        2. 10.2.3.2. The Shells Provider
      4. 10.2.4. A More Complex Type and Provider
        1. 10.2.4.1. The httpauth Type
        2. 10.2.4.2. The httpauth Provider
      5. 10.2.5. Testing Types and Providers
      6. 10.2.6. Writing Custom Functions
    3. 10.3. Summary
    4. 10.4. Resources
  16. 11. Marionette Collective
    1. 11.1. Installing and Configuring RabbitMQ
      1. 11.1.1. Installing RabbitMQ on Debian
      2. 11.1.2. Installing RabbitMQ on RHEL / CentOS
      3. 11.1.3. RabbitMQ Configuration
      4. 11.1.4. Installing MCollective on Debian and Ubuntu
      5. 11.1.5. Installing MCollective on Enterprise Linux
      6. 11.1.6. MCollective Server Configuration
    2. 11.2. MCollective Plugins
      1. 11.2.1. Puppet Agent MCollective Plugins
        1. 11.2.1.1. Downloading the Plugins
        2. 11.2.1.2. Installing an MCollective Agent Plugin
        3. 11.2.1.3. Loading the Agent Plugin
        4. 11.2.1.4. Verifying the Agent Plugin is Loaded
        5. 11.2.1.5. Running Puppet from MCollective
        6. 11.2.1.6. Listing All Loaded Agent Plugins
      2. 11.2.2. The Facter Plugin for MCollective
      3. 11.2.3. Additional Plugins
    3. 11.3. Addressing Hosts with Metadata
    4. 11.4. Summary
    5. 11.5. Resources
  17. A. Working with Puppet
    1. A.1. Getting Support and Training
    2. A.2. Resources
      1. A.2.1. Web
      2. A.2.2. Mailing Lists
      3. A.2.3. Puppet Module Forge
      4. A.2.4. Puppet Enterprise
      5. A.2.5. Support (commercial)
      6. A.2.6. Training
      7. A.2.7. IRC
3.17.154.171