Build reliable, scalable, secure, and high-performance systems to fully utilize the power of cloud computing.
Nearly 10,000 copies sold
Get ready for Puppet 3
The Puppet 3 Cookbook is fully updated to cover Puppet 3 and with masses of new material, tips, recipes, ideas, and fully-working example code to help you kick-start your Puppet infrastructure. If you enjoyed the Puppet 3 Beginners Guide, or if you’re an experienced Puppet user already, the Puppet 3 Cookbook is the book to take your Puppet knowledge to the next level.
Shows you how to use Puppet 3 to take control of your servers and desktops, with detailed step-by-step instructions
Written in a simple, practical style by a professional systems administrator and Puppet expert, every recipe has detailed step-by-step instructions showing you the exact commands and configuration settings you need.
Packed with tips and inspiring ideas for using Puppet to automate server builds, deployments, and workflows.
Covers all the popular tools and frameworks used with Puppet: Hiera, RSpec, puppet-lint, and more
Teaches you how to extend Puppet with custom functions, types, and providers.
What they said
“Excellent book even for experienced Puppet practioners. I wanted to enhance my Puppet knowledge and this book does just that. From using tags to encrypting sensitive data or with HieraGPG or creating your own custom function this book covers a tremendous amount of material.”
“This book has some excellent examples and a good overview of some of the more advanced features of Puppet.”
What’s in it
The book takes the reader from a basic knowledge of Puppet to a complete and expert understanding of Puppet’s latest and most advanced features, community best practices, writing great manifests, scaling and performance, and how to extend Puppet by adding your own providers and resources. It starts with help on how to set up and expand your Puppet infrastructure, progresses through detailed information on the language and features, external tools, reporting, monitoring, and troubleshooting, and concludes with many specific recipes for managing popular applications.
The book includes real examples from production systems and techniques that are in use in some of the world’s largest Puppet installations, including a distributed Puppet architecture based on the Git version control system. It covers common problems and errors and shows you how to troubleshoot your Puppet manifests. You’ll be introduced to powerful tools that work with Puppet such as Hiera. You’ll learn how to use objection-orientation and classes to write powerful, reusable manifests, and how to embed Ruby code in templates. You’ll find out how to extend Puppet with custom resource types and providers. The book also explains managing Ruby applications and MySQL databases, building web servers, load balancers, high-availability systems with Heartbeat, and many other state-of-the-art techniques.
More and more systems administration and IT jobs require some knowledge of configuration management, and specifically Puppet. The Puppet 3 Cookbook not only gives you everything you need to become a Puppet expert, but includes powerful code samples and techniques developed over many years of production experience. With it, you’ll save time and effort by automating tedious manual processes, impress your boss by delivering better business value from IT, and future-proof your career by getting to grips with the new technologies revolutionizing the industry.
What you’ll learn
- Installing and setting up Puppet for the first time
- Producing eye-catching reports and information for management
- Understanding common error messages and troubleshooting common problems
- Managing large networks
- Taking control of configuration data with Hiera and encrypting secrets with GnuPG
- Producing reliable, clean, maintainable code to community standards with puppet-lint and rspec-puppet
- Using classes and inheritance to write powerful Puppet code
- Deploying configuration files and templates for lightning-fast installations
- Using virtual machines to build test and staging environments, and production systems on cloud platforms such as EC2
- Automating every aspect of your systems including provisioning, deployment and change management
- Making Puppet reliable, performant, and scalable
Who the book is for
The book is for anyone who builds and administers servers, especially in a web operations context. It requires some experience of Linux systems administration, including familiarity with the command line, file system, and text editing. No programming experience is required.
Buy the Puppet 3 Cookbook
- Buy Puppet 3 Cookbook (Kindle edition) now on Amazon.co.uk
- Buy Puppet 3 Cookbook (paperback) now on Amazon.com
- Buy Puppet 3 Cookbook (Kindle) now on Amazon.com
“I’ve looked at lots of different tutorials on Puppet. Yours have been by far the most practical and easiest to understand.”
Those nice people at Packt Publishing have asked me to write a follow-up to the surprisingly successful Puppet Cookbook. This book, the Puppet 3 Beginner’s Guide caters for those who are completely new to Puppet, and takes you through installation, setup, writing your first manifests, using Git to manage and distribute your manifests, managing users, reporting and troubleshooting, and a few other useful things.
Some of the most respected people working in devops and configuration management have contributed to the book’s development by reading early chapters, giving feedback, testing code, and making suggestions.
What they said
“Well-written… smoothly-structured… John Arundel’s new book is a solid guide to helping you become both a proficient Puppet user and a more efficient, knowledgeable, and versatile system administrator.”
“I can’t imagine having found anything better. This book avoids the stress and boredom of a slow-paced learning session by diving right in to the most important concepts. It was all I needed to feel confident at work, and it only took an hour before I was writing my own code.”
“John Arundel is both a superb engineer and just as importantly an excellent teacher/communicator. Currently the best Puppet book available and essential for anyone wanting to learn Puppet.”
— Amazon.com (Kindle edition)
Introduction to Puppet
What’s the problem with computers?
In this chapter you’ll learn what Puppet is, and what it can help you do. Whether you’re a system administrator, a developer who needs to fix servers from time to time, or just someone who’s annoyed at how long it takes to set up a new laptop, you’ll have come across the kind of problems Puppet is designed to solve.
- What is configuration management?
- What problems is Puppet trying to solve?
- How do you work differently as a systems administrator using Puppet?
First steps with Puppet
In this chapter you’ll learn how to install Puppet, how to write your first manifest, and how to put Puppet to work configuring a server. You’ll also understand how Puppet reads and applies a manifest.
- Installing Puppet
- Creating your first manifest
- Making your first changes on a machine with Puppet
Packages, files, and services
The most common types of resources you’ll manage with Puppet are packages, files, and services. They often occur together, with a package providing a service, and the service requiring a configuration file. In this chapter you’ll see how to use Puppet to manage these resources effectively.
- Managing packages
- Managing services
- Resource dependencies
- Managing config files
- The package - file - service pattern
- A complete worked example using Nginx and a simple website
Managing Puppet with Git
In this chapter you’ll learn how to use the Git version control system to manage your Puppet manifests. I’ll also show you how to use Git to distribute the manifests to multiple machines, so that you can start managing your whole network with Puppet.
- Introduction to Git
- Using Git to version control your Puppet code
- Committing changes
- Looking at revision history
- Reverting changes
- Merging commits
- Using Git to deploy Puppet manifests to multiple servers
- Setting up remote access to Git
- Pulling updates and running Puppet from cron
- Using feature branches
In this chapter you’ll learn how to use Puppet to create and manage user accounts, configure SSH access and keys, and control user privileges via sudo.
- Creating user accounts with Puppet
- Configuring SSH
- Distributing SSH keys
- Controlling sudo privileges
- Locking and removing user accounts.
Tasks and templates
In this chapter you’ll learn how to use Puppet’s resource types to run commands, schedule regular tasks, and distribute large trees of files. You’ll also find out how to insert values dynamically into files using templates.
- Using exec resources to run commands
- Using cron resources to run scheduled jobs
- Deploying trees of files
- Using templates
Definitions and classes
In this chapter you’ll learn how to group resources into reusable clumps that you can refer to by name, making it easy to create lots of similar resources at once. You can also make your Puppet manifests shorter, neater, and more readable by eliminating duplicated code.
Expressions and logic
In this chapter you’ll learn how to make choices in your Puppet manifests, how to do arithmetic, logic, and string operations in the Puppet language, and how to use regular expressions to match patterns in strings. You’ll also find out about some useful Puppet data types: arrays and hashes.
- If statements
- Case statements
- Regular expressions
- Capture variables
- Regular expression substitutions
- Arrays and hashes
- Multi-level hashes
Reporting and troubleshooting
In this chapter you’ll learn how to get information on what Puppet’s doing, when it runs, the changes it makes, how to monitor Puppet, and what to do about many common errors you may encounter.
- Dry-run mode
- Debug mode
- Printing messages
- Exec output
- Monitoring Puppet
- Causes of Puppet run failures
- Common Puppet errors and how to fix them
Moving on up
In this chapter you’ll learn some simple principles for writing better Puppet manifests, including style and code layout. You’ll also find out what resources are available for learning more about Puppet, and get some ideas for more advanced projects to build your Puppet knowledge and improve your infrastructure.
- Style guidelines
- Module design
- Learning more
- Project ideas
The Puppet 3 Beginner’s Guide is available on Amazon or via the publisher: