Puppet 5 Essentials - Third Edition

Book description

A Guide to managing servers and automation

About This Book

  • Breeze through Puppet's key features and performance improvements to bring real advantages to your IT infrastructure
  • Discover Puppet best practices to help you avoid common mistakes and pitfalls
  • Examples to help you get to grips with Puppet and succeed with everyday IT automation

Who This Book Is For

This book targets experienced IT professionals and new Puppet uses, who will learn all they need to know to go from installation to advanced automation. Get a rapid introduction to the essential topics and learn how to build best practices for advanced automation with Puppet.

What You Will Learn

  • Understand declarative configuration management
  • Make use of GIT-based deployment workflows
  • Extend Factor with secure elements
  • Create modular and reusable Puppet code
  • Extend your code base with publicly available Puppet modules
  • Separate logic from data by using Hiera
  • Understand and develop Puppet Roles and Profiles

In Detail

Puppet is a configuration management tool that allows you to automate all your IT configurations, giving you control over what you do to each Puppet Agent in a network, and when and how you do it. In this age of digital delivery and ubiquitous Internet presence, it's becoming increasingly important to implement scaleable and portable solutions, not only in terms of software, but also the system that runs it.

This book gets you started quickly with Puppet and its tools in the right way. It highlights improvements in Puppet and provides solutions for upgrading. It starts with a quick introduction to Puppet in order to quickly get your IT automation platform in place. Then you learn about the Puppet Agent and its installation and configuration along with Puppet Server and its scaling options. The book adopts an innovative structure and approach, and Puppet is explained with flexible use cases that empower you to manage complex infrastructures easily.

Finally, the book will take readers through Puppet and its companion tools such as Facter, Hiera, and R10k and how to make use of tool chains.

Style and approach

This book aims to impart all the knowledge required to tap into not only the basics of Puppet, but also its core. The basic ideas and principles of Puppet-based designs are explored and explained. Sophisticated tools are presented to enable you to use Puppet efficiently and productively.

Table of contents

  1. 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. Downloading the color images of this book
      3. Errata
      4. Piracy
      5. Questions
  2. Writing Your First Manifests
    1. Getting started
    2. Introducing resources, parameters, and properties
    3. Interpreting output of the puppet apply command
      1. Dry testing your manifest
    4. Using variables
      1. Variable types
      2. Data types
    5. Adding control structures in manifests
    6. Controlling the order of execution
      1. Declaring dependencies
      2. Error propagation
      3. Avoiding circular dependencies
    7. Implementing resource interaction
    8. Examining Puppet core 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
  3. Puppet Server and Agents
    1. The Puppet server
      1. Setting up the server machine
      2. Creating the master manifest
      3. Inspecting the configuration settings
    2. Setting up the Puppet agent
      1. The agent's life cycle
        1. Renewing an agent's certificate
        2. Running the agent from cron
    3. Performance optimizations
      1. Tuning puppetserver
    4. Completing the stack with PuppetDB
    5. The Puppet CA
    6. Summary
  4. A Peek into the Ruby Part of Puppet - Facts, Types, and Providers
    1. Putting it all together - collecting system information with Facter
    2. Accessing and using fact values
    3. Extending Facter with custom facts
    4. Simplifying things using external facts
    5. Goals of Facter
      1. Understanding the type system
    6. The resource type's life cycle on the agent side
    7. Command execution control with providers
      1. Resource types with generic providers
    8. Summarizing types and providers
      1. Putting it all together
    9. Summary
  5. Combining Resources in 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. 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
        1. Exploiting array values using defined types
      6. Using iterator functions
    3. Including classes from defined types
    4. Ordering and events among classes
      1. Passing events between classes and defined types
    5. Ordering containers
    6. Limitations
      1. The performance implications of container relationships
      2. Mitigating the limitations
        1. The anchor pattern
        2. The contain function
    7. Making classes more flexible through parameters
      1. The caveats of parameterized classes
      2. Preferring the include keyword
    8. Summary
  6. Combining Classes, Configuration Files, and Extensions into Modules
    1. The contents of Puppet's modules
      1. Parts of a module
      2. Module structure
      3. Documentation in modules
    2. Managing environments
      1. Configuring environment locations
      2. Obtaining and installing modules
      3. Module best practices
      4. Putting everything in modules
      5. Avoiding generalization
      6. Testing your modules
      7. Safe testing with environments
    3. Building a component module
      1. Naming your module
      2. Making your module available to Puppet
      3. Implementing basic module functionality
      4. Creating utilities for derived manifests
      5. Adding configuration items
      6. Allowing customization
      7. Removing unwanted configuration items
      8. Dealing with complexity
      9. Enhancing the agent through plugins
    4. Replacing a defined type with a native type
      1. Naming your type
      2. Creating the resource type's 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
    5. Enhancing Puppet's system knowledge through facts
    6. Refining the interface of your module through custom functions
    7. Making your module portable across platforms
    8. Finding helpful Forge modules
      1. Identifying module characteristics
    9. Summary
  7. The Puppet Beginners Advanced Parts
    1. Building dynamic configuration files
      1. Learning the template syntax
      2. Using templates in practice
      3. Avoiding performance bottlenecks from templates
    2. Managing file snippets
      1. Single entry in a section
      2. Building from multiple snippets
    3. Using virtual resources
      1. Realizing resources more flexibly using collectors
    4. Cross-node configuration with exported resources
      1. Exporting and collecting 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 configuration of Nagios
      7. Maintaining your central firewall
      8. Removing obsolete exports
    5. Setting defaults for resource parameters
      1. Saving redundancy using resource defaults
    6. Avoiding antipatterns
    7. Summary
  8. New Features from Puppet 4 and 5
    1. Upgrading to Puppet 4
      1. Using Puppet 3.8 and environment directories
      2. The Puppet 4 and 5 master
      3. Updating the Puppet agent
      4. Testing Puppet DSL code
        1. Using the type system
    2. Learning lambdas and functions
    3. Creating Puppet 4 functions
    4. Leveraging the new template engine
    5. Handling multiline with HEREDOC
    6. Using Puppet 5 server metrics
    7. Breaking old practices
      1. Converting node inheritance
      2. Dealing with bool algebra on Strings
      3. Using strict variable naming
      4. Learning the new reference syntax
      5. Cleaning hyphens in names
      6. No Ruby DSL anymore
      7. Relative class name resolution
      8. Dealing with different data types
    8. Summary
  9. Separation of Code and Data with Hiera
    1. Understanding the need for separate data storage
      1. Consequences of defining data in the manifest
    2. Building hierarchical data structures
      1. Configuring Hiera
      2. Storing Hiera data
      3. Choosing your backends
    3. Fetching data from classes
      1. Working with simple values
      2. Binding class parameter values automatically
      3. Handling hashes and arrays
      4. Choosing between manifest and Hiera designs
    4. Debugging data lookups
    5. Managing resources from data
      1. Hiera version 5
    6. Summary
  10. Puppet Roles and Profiles
    1. Technical component modules
    2. Implementing components in profiles
    3. The business use case and node classification
    4. Building roles from profiles
    5. Placing code on the Puppet server
      1. The Puppet control repository
      2. Synchronizing upstream modules
      3. R10K code deployment
    6. Summary

Product information

  • Title: Puppet 5 Essentials - Third Edition
  • Author(s): Martin Alfke, Felix Frank
  • Release date: September 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781787284715