Book description
Write custom plugins for Puppet, including facts, providers, and functions
About This Book- Grasp recipes that work with centralized and decentralized deployments
- Explore language differences and enhancements anticipated in Puppet version 5.x
- Gain expert understanding of Puppet's latest and most advanced features
Puppet 5 Cookbook is for anyone who builds and administers servers, especially in a web operations context. You'll need some experience of Linux systems administration, including familiarity with the command line, filesystem, and text editing. No prior programming experience is required.
What You Will Learn- Discover the latest and most advanced features of Puppet
- Bootstrap your Puppet installation using powerful tools like Rake
- Master techniques to deal with centralized and decentralized Puppet deployments
- Use exported resources and forge modules to set up Puppet modules
- Create efficient manifests to streamline your deployments
- Automate Puppet master deployment using Git hooks and PuppetDB
- Make Puppet reliable, performant, and scalable
Puppet is a configuration management system that automates all your IT configurations, giving you control of managing each node.Puppet 5 Cookbook will take you through Puppet's latest and most advanced features, including Docker containers, Hiera, and AWS Cloud Orchestration. Updated with the latest advancements and best practices, this book delves into various aspects of writing good Puppet code, which includes using Puppet community style, checking your manifests with puppet-lint, and learning community best practices with an emphasis on real-world implementation.
You will learn to set up, install, and create your first manifests with Puppet version control, and also understand various sysadmin tasks, including managing config files, using Augeas, and generating files from snippets and templates. As the book progresses, you'll explore virtual resources and use Puppet's resource scheduling and auditing features. In the concluding chapters, you'll walk through managing applications and writing your own resource types, providers, and external node classifiers.
By the end of this book, you will have learned to report, log, and debug your system.
Style and approachA recipe-based guide filled with quick step-by-step instructions that are immediately applicable
Table of contents
- Title Page
- Copyright and Credits
- Packt Upsell
- Contributors
- Preface
-
Puppet Language and Style
- Introduction
- Adding a resource to a node
- Using facter to describe a node
- Using puppet facts
- Installing a package before starting a service
- Installing, configuring, and starting a service
- Using community Puppet style
- Installing Puppet
- Creating a manifest
- Checking your manifests with puppet-lint
- Making modules
- Using standard naming conventions
- Using inline templates
- Iterating over multiple items
- Writing powerful conditional statements
- Using regular expressions in if statements
- Using selectors and case statements
- Using the in operator
- Using regular expression substitutions
- Puppet 5 changes
- Puppet 4/5 changes
-
Puppet Infrastructure
- Introduction
- Managing your manifests with Git
- Creating a decentralized Puppet architecture
- Writing a papply script
- Running Puppet from cron
- Bootstrapping Puppet with bash
- Creating a centralized Puppet infrastructure
- Creating certificates with multiple DNS names
- Setting up the environment
- Configuring PuppetDB
- Configuring Hiera
- Environment-specific Hiera
- Setting node-specific data with Hiera
- Writing a custom Hiera5 function
- Storing secret data with hiera-eyaml
- Automatic syntax-checking with Git hooks
- Pushing code around with Git
- Managing environments with Git
-
Writing Better Manifests
- Introduction
- Using arrays of resources
- Using resource defaults
- Using defined types
- Using tags
- Using run stages
- Using roles and profiles
- Using data types in Puppet
- Passing parameters to classes
- Passing parameters from Hiera
- Writing reusable, cross-platform manifests
- Getting information about the environment
- Importing dynamic information
- Passing arguments to shell commands
-
Working with Files and Packages
- Introduction
- Making quick edits to config files
- Editing INI-style files with puppetlabs-inifile
- Using Augeas to reliably edit config files
- Building config files using snippets
- Using ERB templates
- Using array iterations in templates
- Using EPP templates
- Using GnuPG to encrypt secrets
- Comparing package versions
- Users and Virtual Resources
- Managing Resources and Files
- Managing Applications
- Servers and Cloud Infrastructure
-
External Tools and the Puppet Ecosystem
- Introduction
- Creating custom facts
- Adding external facts
- Setting facts as environment variables
- Generating manifests with the Puppet resource command
- Generating manifests with other tools
- Using PDK
- Using an external node classifier
- Creating your own resource types
- Creating your own providers
- Creating custom functions
- Testing your puppet manifests with rspec-puppet
-
Monitoring, Reporting, and Troubleshooting
- Introduction
- Noop—the don't-change-anything option
- Logging the command output
- Logging debug messages
- Generating reports
- Producing automatic HTML documentation
- Drawing dependency graphs
-
Understanding Puppet errors
-
How to do it...
- Could not retrieve file metadata for XXX: getaddrinfo: Name or service not known
- Could not evaluate: Could not retrieve information from environment production source(s) XXX
- Error: Could not set 'file' on ensure: No such file or directory XXX
- Change from absent to file failed: Could not set 'file on ensure: No such file or directory
- Undefined method 'closed?' for nil:NilClass
- Duplicate definition: X is already defined in [file] at line Y; cannot redefine at [file] line Y
- See also
-
How to do it...
- Inspecting configuration settings
- Other Books You May Enjoy
Product information
- Title: Puppet 5 Cookbook - Fourth Edition
- Author(s):
- Release date: June 2018
- Publisher(s): Packt Publishing
- ISBN: 9781788622448
You might also like
book
Puppet Cookbook - Third Edition
Jump-start your Puppet deployment using engaging and practical recipes In Detail Puppet is a configuration management …
book
Puppet 5 Beginner's Guide - Third Edition
Puppet 5 Beginner’s Guide, Third Edition is a practical guide that gets you up and running …
video
Puppet for Absolute Beginners - Hands-on
Puppet is a leading IT automation platform in DevOps that is used to manage various stages …
video
Puppet 6 Essentials
With Puppet, you can configure many servers and automate your IT configuration easily and efficiently. This …