Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Puppet 5 Cookbook
  • Toc
  • feedback
Puppet 5 Cookbook

Puppet 5 Cookbook

By : Thomas Uphill
3.7 (3)
close
Puppet 5 Cookbook

Puppet 5 Cookbook

3.7 (3)
By: Thomas Uphill

Overview of this book

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 version control, and also learn about various sysadmin tasks, including managing configuration 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.
Table of Contents (12 chapters)
close

To get the most out of this book

You will need a computer capable of running Linux virtual machines. The examples in the book use Debian and Enterprise Linux-based distributions (RHEL and CentOS). Some of the examples will require multiple virtual machines to be run concurrently. You will need a host machine capable of running three or four virtual machines simultaneously. A minimum of 8 GB of RAM is suggested for performance reasons. To configure a test environment similar to that used in the production of the book, Vagrant should be used. Vagrant is a tool developed by Hashicorp to enable quick deployment of virtual machines via a definition file,  Vagrantfile. More information on Vagrantfile syntax is available at https://www.vagrantup.com/docs/vagrantfile/. Vagrantfile used to build the example systems in this book is provided in the files section. To effectively use the Vagrantfile provided, you will need to install the vagrant-hosts plugin. To do so, issue the following command:

[t@mylaptop ~] $ vagrant plugin install vagrant-hosts
Installing the 'vagrant-hosts' plugin. This can take a few minutes...
Fetching: vagrant-hosts-2.8.2.gem (100%)
Installed the plugin 'vagrant-hosts (2.8.2)'!

This will allow Vagrant to update the /etc/hosts file on your nodes with host entries for the other nodes in your test environment (for example, puppet.example.com and git.example.com). It is also convenient to configure ssh to connect to your test machines. After copying down Vagrantfile into a directory on your machine, cd into that directory. Check whether Vagrant is configured properly using the following command:

[t@mylaptop ~/cookbook] $ vagrant status
Current machine states:

cookbook poweroff (virtualbox)
puppet running (virtualbox)

This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run `vagrant status NAME`.

Now, copy the output of the following command into the .ssh/config file in your home directory as shown here:

[t@mylaptop ~/cookbook] $ vagrant ssh-config puppet >>~/.ssh/config

This will enable you to do the following:

[t@mylaptop ~/cookbook] $ ssh puppet
Last login: Mon Jun 18 20:13:21 2018 from 10.0.2.2
puppet.example.com
Managed by puppet 5.5.2
[vagrant@puppet ~]$ hostname
puppet.example.com

Download the example code files

You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packtpub.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Puppet-5-Cookbook-Fourth-EditionIn case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Apply this manifest using puppet apply git.pp; this will install Git."

A block of code is set as follows:

package {'git':
ensure => installed
}

Any command-line input or output is written as follows:

t@mylaptop ~/.ssh $ ssh-copy-id -i git_rsa [email protected]
[email protected]'s password:
Number of key(s) added: 1

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Select System info from the Administration panel."

Warnings or important notes appear like this.
Tips and tricks appear like this.
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete