You are previewing Puppet Essentials.
O'Reilly logo
Puppet Essentials

Book Description

Get up and running quickly using the power of Puppet to manage your IT infrastructure

In Detail

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.

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.

What You Will Learn

  • Write and employ individual Puppet manifests
  • Understand how Puppet implements system abstraction
  • Deploy the Puppet master and its agents
  • Leverage and extend Facter to summarize your systems
  • Create modular and reusable Puppet code
  • Extend your code base with publicly available Puppet modules
  • Separate logic from data using Hiera
  • Combine your new skills to manage large, complex systems
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. 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.

    Table of Contents

    1. Puppet Essentials
      1. Table of Contents
      2. Puppet Essentials
      3. Credits
      4. About the Author
      5. Acknowledgments
      6. About the Reviewers
      7. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      8. 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
      9. 1. Writing Your First Manifests
        1. Getting started
        2. Introducing resources and properties
        3. Interpreting the output of the puppet apply command
          1. Dry-testing your manifest
        4. Adding control structures in manifests
        5. Using variables
          1. Variable types
        6. Controlling the order of evaluation
          1. Declaring dependencies
          2. Error propagation
          3. Avoiding circular dependencies
        7. Implementing resource interaction
        8. Examining the most notable resource types
          1. The user and group types
          2. The exec resource type
          3. The cron resource type
          4. The mount resource type
        9. Summary
      10. 2. The Master and Its Agents
        1. The Puppet master
          1. Setting up the master machine
          2. Creating the master manifest
          3. Inspecting the configuration settings
        2. Setting up the Puppet agent
          1. The agent's life cycle
          2. Renewing an agent's certificate
          3. Running the agent from cron
        3. Performance considerations
          1. Switching to Phusion Passenger
          2. Using Passenger with Nginx
          3. Basic tuning
        4. Troubleshooting SSL issues
        5. Summary
      11. 3. A Peek Under the Hood – Facts, Types, and Providers
        1. Summarizing systems with Facter
          1. Accessing and using fact values
          2. Extending Facter with custom facts
            1. Simplifying things using external facts
          3. Goals of Facter
        2. Understanding the type system
          1. The resource type's life cycle on the agent side
        3. Substantiating the model with providers
          1. Providerless resource types
          2. Summarizing types and providers
        4. Putting it all together
        5. Summary
      12. 4. Modularizing Manifests with Classes and Defined Types
        1. Introducing classes and defined types
          1. Defining and declaring classes
          2. Creating and using defined types
          3. Understanding and leveraging the differences
        2. Structured design patterns
          1. Writing comprehensive classes
          2. Writing component classes
          3. Using defined types as resource wrappers
          4. Using defined types as resource multiplexers
          5. Using defined types as macros
          6. Exploiting array values using defined types
        3. Including classes from defined types
        4. Nesting definitions in classes
        5. Establishing relationships among containers
          1. Passing events between classes and defined types
          2. Ordering containers
          3. Limitations
          4. Performance implications of container relationships
          5. Mitigating the limitations
            1. The anchor pattern
            2. The contain function
        6. Making classes more flexible through parameters
          1. Caveats of parameterized classes
          2. Preferring the include keyword
        7. Summary
      13. 5. Extending Your Puppet Infrastructure with Modules
        1. An overview of Puppet's modules
          1. Parts of a module
          2. How the content of each module is structured
          3. Documentation in modules
        2. Maintaining environments
          1. Configuring environment locations
          2. Obtaining and installing modules
          3. Modules' best practices
          4. Putting everything in modules
          5. Avoiding generalization
          6. Testing your modules
            1. Safe testing with environments
        3. Building a specific module
          1. Naming your module
          2. Making your module available to Puppet
          3. Implementing the basic module functionality
          4. Creating utilities for derived manifests
            1. Adding configuration items
            2. Allowing customization
            3. Removing unwanted configuration items
            4. Dealing with complexity
          5. Enhancing the agent through plugins
            1. Replacing a defined type with a native type
              1. Naming your type
              2. Creating the resource type interface
              3. Designing sensible parameter hooks
              4. Using resource names
              5. Adding a provider
              6. Declaring management commands
              7. Implementing the basic functionality
              8. Allowing the provider to prefetch existing resources
              9. Making the type robust during provisioning
          6. Enhancing Puppet's system knowledge through facts
          7. Refining the interface of your module through custom functions
          8. Making your module portable across platforms
        4. Finding helpful Forge modules
          1. Identifying modules' characteristics
        5. Summary
      14. 6. Leveraging the Full Toolset of the Language
        1. Templating dynamic configuration files
          1. Learning the template syntax
          2. Using templates in practice
          3. Avoiding performance bottlenecks from templates
        2. Creating virtual resources
          1. Realizing resources more flexibly using collectors
        3. Exporting resources to other agents
          1. Exporting and importing resources
          2. Configuring the master to store exported resources
          3. Exporting SSH host keys
          4. Managing hosts files locally
          5. Automating custom configuration items
          6. Simplifying the Nagios configuration
          7. Maintaining your central firewall
        4. Overriding resource parameters
        5. Making classes more flexible through inheritance
          1. Understanding class inheritance in Puppet
          2. Naming an inheriting class
          3. Making parameters safer through inheritance
        6. Saving redundancy using resource defaults
        7. Avoiding antipatterns
        8. Summary
      15. 7. Separating Data from Code Using Hiera
        1. Understanding the need for separate data storage
          1. Consequences of defining data in the manifest
        2. Structuring configuration data in a hierarchy
          1. Configuring Hiera
          2. Storing Hiera data
          3. Choosing your backends
        3. Retrieving and using Hiera values in manifests
          1. Working with simple values
          2. Binding class parameter values automatically
          3. Handling hashes and arrays
        4. Converting resources to data
          1. Choosing between manifest and Hiera designs
        5. Using Hiera in different contexts
        6. A practical example
        7. Debugging Hiera lookups
        8. Summary
      16. 8. Configuring Your Cloud Application with Puppet
        1. Typical scopes of Puppet
          1. Common data center use – roles and profiles
        2. Taking Puppet to the cloud
          1. Initializing agents in the cloud
          2. Using Puppet's cloud-provisioner module
        3. Building manifests for the cloud
          1. Mapping functionalities to nodes
          2. Choosing certificate names
          3. Creating a distributed catalog
          4. Composing arbitrary configuration files
          5. Handling instance deletions
        4. Preparing for autoscaling
          1. Managing certificates
          2. Limiting round trip times
        5. Ensuring successful provisioning
          1. Adding necessary relationships
          2. Testing the manifests
        6. Summary
      17. Index