Extending Puppet

Book description

Design, manage, and deploy your Puppet architecture with the help of real-world scenarios

In Detail

Puppet has changed the way we manage our systems, but Puppet itself is changing and evolving, as are the ways in which we use it.

A clear, updated, practical, and focused view of the current state of the technology and the evolution of Puppet is what we need to tackle our IT infrastructure challenges and avoid common errors when designing our architectures.

This is a detailed, practical book that covers the different components of the Puppet ecosystem and explores how to use them to deploy and manage different kinds of IT infrastructures.

Updated with the most recent trends and best practices, this book gives you a clear view on how to "connect the dots" and expands your understanding to successfully use and extend Puppet.

What You Will Learn

  • Use Puppet to manage network, cloud, and virtualization devices
  • Become a Hiera and PuppetDB power user
  • Study the different approaches to Puppet architecture design
  • Master the art of writing and maintaining reusable modules
  • Explore strategies and patterns on how to introduce Puppet automation
  • Manage and test a Puppet code workflow
  • Design scalable Puppet infrastructures

Table of contents

  1. Extending Puppet
    1. Table of Contents
    2. Extending Puppet
    3. Credits
    4. Foreword
    5. About the Author
    6. Acknowledgments
    7. About the Reviewers
    8. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    9. 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
    10. 1. Puppet Essentials
      1. The Puppet ecosystem
        1. Why configuration management matters
      2. Puppet components
      3. Installation and configuration
      4. Puppet in action
        1. Resources
          1. The resource abstraction layer
        2. Nodes
        3. Classes and defines
          1. Class inheritance
        4. Resource defaults
        5. Resource references
        6. Variables, facts, and scopes
          1. System's facts
          2. User variables in Puppet DSL
          3. User variables in an ENC
          4. User variables in Hiera
          5. Puppet's built-in variables
          6. A variable's scope
        7. Meta parameters
        8. Managing order and dependencies
          1. Run stages
        9. Reserved names and allowed characters
        10. Conditionals
        11. Comparison operators
          1. The In operator
          2. Expressions combinations
        12. Exported resources
          1. Virtual resources
        13. Modules
          1. The paths of a module and autoloading
          2. ERB templates
            1. Restoring files from a filebucket
      5. Summary
    11. 2. Hiera
      1. Installing and configuring Hiera
        1. Global settings
        2. Backend-specific settings
        3. The hiera.yaml examples
      2. Working with the command line on a YAML backend
      3. Using Hiera in Puppet
        1. Dealing with hashes in the Puppet code
        2. Puppet 3 automatic parameter lookup
        3. Evolving usage patterns for class parameters
      4. Additional Hiera backends
        1. The hiera-file backend
        2. The hiera-gpg backend
        3. The hiera-eyaml backend
        4. The hiera-http and hiera-mysql backends
      5. Using Hiera as an ENC
      6. Summary
    12. 3. PuppetDB
      1. Installation and configuration
        1. PuppetDB configurations
          1. The init script configuration
          2. Configuration settings
          3. Logging configuration
        2. Configurations on the Puppet Master
      2. Dashboards
        1. PuppetDB performance dashboard
        2. Puppetboard – query PuppetDB from the Web
      3. The PuppetDB API
        1. Querying PuppetDB (Read)
        2. The PuppetDB commands (Write)
      4. Querying PuppetDB for fun and profit
        1. The /facts endpoint
        2. The /resources endpoint
        3. The /nodes endpoint
        4. The /catalogs endpoint
        5. The /facts-names endpoint
        6. The /metrics endpoint
        7. The /reports endpoint
        8. The /events endpoint
        9. The /event-counts endpoint
        10. The /aggregated-event-counts endpoint
        11. The /server-time endpoint
        12. The /version endpoint
      5. The puppetdbquery module
        1. Query format
          1. Query from the command line
          2. Query from Puppet manifests
          3. The PuppetDB Hiera backend
      6. How Puppet code may change in the future
      7. Summary
    13. 4. Designing Puppet Architectures
      1. The components of Puppet architecture
        1. Defining the classes to include in each node
        2. Defining the parameters to use for each node
        3. Defining the configuration files provided to the nodes
        4. Defining custom resources and classes
      2. The Foreman
      3. Roles and profiles
      4. The data and the code
      5. Sample architectures
        1. The default approach
        2. Basic ENC, logic in the site module, and Hiera backend
        3. The Foreman and Hiera
        4. The Hiera-based setup
        5. The Hiera-only setup
        6. Foreman smart variables
        7. Fact-driven truths
        8. Nodeless site.pp
        9. Node inheritance done right
      6. Summary
    14. 5. Using and Writing Reusable Modules
      1. The evolution of modules' layouts
        1. Class parameters – from zero to data bindings
        2. The params pattern
        3. Data in modules
        4. Files and class names
        5. The anchor pattern
      2. The parameters dilemma
        1. Naming standards
      3. Reusability patterns
        1. Managing files
          1. Managing configuration hash patterns
          2. Managing multiple configuration files
          3. Managing users and dependencies
          4. Managing the installation options
          5. Managing extra resources
      4. Summary
    15. 6. Higher Abstraction Modules
      1. Understanding the need for higher abstractions
      2. The OpenStack example
        1. Component (application) modules
        2. Raising abstraction – the official openstack module
        3. Raising abstraction – the Puppet Labs OpenStack module
        4. Raising abstraction – the scenario-based approach
        5. Taking an alternate approach
      3. An approach to reusable stack modules
      4. Summary
    16. 7. Deploying and Migrating Puppet
      1. Examining the potential scenarios and approaches
        1. New infrastructures
        2. Existing manually managed infrastructures
          1. Node migration
          2. Node update
        3. Existing automated infrastructures
          1. Upgrading the Puppet Master
      2. Patterns for extending Puppet coverage
        1. Raising the bar, step by step
        2. Knowing the territory
        3. Defining priorities
          1. Automate servers deployment
          2. Automate common configurations
          3. Automate the most important roles
          4. Refine and automate application deployments
          5. Integrate what already works well
          6. Automate monitoring
        4. Evaluating solutions
        5. Coding
        6. Applying changes
      3. Things change
        1. Infrastructure as code
          1. Versioning
          2. Reproducibility and predictability
          3. Testing
          4. Maintenance
        2. Evolution of the system administrator
        3. Designing a Puppet-friendly infrastructure
      4. Summary
    17. 8. Code Workflow Management
      1. Writing the Puppet code
        1. Geppetto
        2. Vim
      2. Git workflows
        1. Git's basic principles and commands
        2. Git hooks
        3. Environments and branches
          1. Branch-based automatic environments
          2. Simplified developer workdir environments
      3. Code review
        1. Gerrit
        2. Online resources for peer review
      4. Testing the Puppet code
        1. Using rspec-puppet
        2. rspec-system-puppet and Beaker
        3. Vagrant
      5. Deploying the Puppet code
        1. Using librarian-puppet for deployments
        2. Deploying code with r10k
      6. Propagating Puppet changes
      7. Puppet Continuous Integration tools
        1. Travis
        2. Jenkins
      8. Summary
    18. 9. Scaling Puppet Infrastructures
      1. Scaling Puppet
        1. As simple as puppet apply
        2. Default Puppet Master
        3. Puppet Master with Passenger
          1. Installing and configuring Passenger
        4. Multi-Master scaling
          1. Managing certificates
          2. Managing SSL termination
          3. Managing code and data
        5. Load balancing alternatives
        6. Masterless Puppet
        7. Configurations and infrastructure optimizations
          1. Traffic compression
          2. Caching
          3. Distributing Puppet execution times
          4. Checking the interval for changes in files
      2. Scaling stored configs
      3. Measuring performance
        1. Puppet metrics
        2. Optimizing code
        3. Testing different Puppet versions
      4. Summary
    19. 10. Writing Puppet Plugins
      1. Anatomy of a Puppet run, under the hood
        1. ENC and Hiera extendibility
        2. Modules' pluginsync
        3. Puppet indirector and its termini
        4. Custom functions
        5. Custom facts
          1. Ruby facts distributed via pluginsync
          2. External facts in the facts.d directory
        6. Custom types and providers
      2. Custom report handlers
      3. Custom faces
      4. Summary
    20. 11. Beyond the System
      1. Puppet on a network equipment
        1. A Proxy mode with the puppet device application
        2. Native Puppet on the network equipment
          1. Cisco onePK
          2. Juniper and netdev_stdlib
      2. Puppet for cloud and virtualization
        1. VMware
          1. VM provisioning on vCenter and vSphere
          2. The integration of vCloud Automation Center
          3. The configuration of vCenter
        2. Amazon Web Services
          1. Cloud provisioning on AWS
        3. AWS provisioning and configuration with resource types
          1. Managing CloudFormation
        4. Cloud provisioning on Google Compute Engine
      3. Puppet on storage devices
      4. Summary
    21. 12. Future Puppet
      1. Introducing the future parser
        1. Lambdas and Iterations
          1. Manipulating and validating hashes and arrays
          2. Other features
        2. Restrictions and backward incompatibilities
        3. Directory environments
        4. Heredoc support
        5. The new type system
      2. Other new features
        1. EPP Templates
        2. The contain function
        3. Serialization with MessagePack
      3. Improved error system
      4. Data in modules
      5. Facter 2
      6. Trapperkeeper
      7. Summary
    22. Index

Product information

  • Title: Extending Puppet
  • Author(s): Alessandro Franceschi
  • Release date: June 2014
  • Publisher(s): Packt Publishing
  • ISBN: 9781783981441