Puppet Cookbook - Third Edition

Jump-start your Puppet deployment using engaging and practical recipes

Puppet Cookbook - Third Edition

Thomas Uphill, John Arundel

Jump-start your Puppet deployment using engaging and practical recipes
Mapt Subscription
FREE
$0.00/m after trial
eBook
$10.00
RRP $26.99
Save 62%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt subscription?
  • Unlimited access to all Packt’s 6,000+ eBooks and Videos
  • 100+ new titles a month, learning paths, assessments & code files
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$10.00
$44.99
$29.99 p/m after trial
RRP $26.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


Puppet Cookbook - Third Edition Book Cover
Puppet Cookbook - Third Edition
$ 26.99
$ 10.00
Puppet: Mastering Infrastructure Automation Book Cover
Puppet: Mastering Infrastructure Automation
$ 67.99
$ 10.00
Buy 2 for $20.00
Save $74.98
Add to Cart

Book Details

ISBN 139781784394882
Paperback336 pages

Book Description

Puppet is a configuration management system that automates all your IT configurations, giving you control of what you do to each node, when you do it, and how you do it.

Puppet Cookbook Third Edition takes the reader from a basic knowledge of Puppet to a complete and expert understanding of Puppet’s latest and most advanced features. Updated with the latest advancements and best practices, it gives you a clear view on how to "connect the dots" and expands your knowledge to successfully use and extend Puppet.

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.

 

 

Read an Extract from the book

Generating manifests with the Puppet resource command

If you have a server that is already configured as it needs to be, or nearly so, you can capture that configuration as a Puppet manifest. The Puppet resource command generates Puppet manifests from the existing configuration of a system. For example, you can have puppet resource generate a manifest that creates all the users found on the system. This is very useful to take a snapshot of a working system and get its configuration quickly into Puppet.

How to do it...

Here are some examples of using puppet resource to get data from a running system:

  1. To generate the manifest for a particular user, run the following command:
    [root@cookbook ~]# puppet resource user thomas
    user { 'thomas':
      ensure           => 'present',
      comment          => 'thomas Admin User',
      gid              => '1001',
      groups           => ['bin', 'wheel'],
      home             => '/home/thomas',
      password         => '!!',
      password_max_age => '99999',
      password_min_age => '0',
      shell            => '/bin/bash',
      uid              => '1001',
          }
  2. For a particular service, run the following command:
    [root@cookbook ~]# puppet resource service sshd
    service { 'sshd':
      ensure => 'running',
      enable => 'true',
    }
  3. For a package, run the following command:
    [root@cookbook ~]# puppet resource package kernel
    package { 'kernel':
      ensure => '2.6.32-431.23.3.el6',
    }

There's more...

You can use puppet resource to examine each of the resource types available in Puppet. In the preceding examples, we generated a manifest for a specific instance of the resource type, but you can also use puppet resource to dump all instances of the resource:

[root@cookbook ~]# puppet resource service
service { 'abrt-ccpp':
  ensure => 'running',
  enable => 'true',
}
service { 'abrt-oops':
  ensure => 'running',
  enable => 'true',
}
service { 'abrtd':
  ensure => 'running',
  enable => 'true',
}
service { 'acpid':
  ensure => 'running',
  enable => 'true',
}
service { 'atd':
  ensure => 'running',
  enable => 'true',
}
service { 'auditd':
  ensure => 'running',
  enable => 'true',
}

This will output the state of each service on the system; this is because each service is an enumerable resource. When you try the same command with a resource that is not enumerable, you get an error message:

[root@cookbook ~]# puppet resource file
Error: Could not run: Listing all file instances is not supported.  Please specify a file or directory, e.g. puppet resource file /etc

Asking Puppet to describe each file on the system will not work; that's something best left to an audit tool such as tripwire (a system designed to look for changes on every file on the system, http://www.tripwire.com)

 

Table of Contents

What You Will Learn

  • Install and set up Puppet for the first time
  • Discover the latest, most advanced, and experimental features of Puppet
  • Bootstrap your Puppet installation
  • Master techniques to deal with centralized and decentralized Puppet deployments
  • Use exported resources and forge modules
  • Create efficient manifests to streamline your deployments
  • Automate Puppet master deployment using Git hooks, r10k, and PuppetDB
  • Make Puppet reliable, performant, and scalable

Authors

Table of Contents

Book Details

ISBN 139781784394882
Paperback336 pages
Read More

Read More Reviews

Recommended for You

Puppet: Mastering Infrastructure Automation Book Cover
Puppet: Mastering Infrastructure Automation
$ 67.99
$ 10.00
Puppet 4.10 Beginner's Guide - Second Edition Book Cover
Puppet 4.10 Beginner's Guide - Second Edition
$ 31.99
$ 10.00
Puppet 4 Essentials - Second Edition Book Cover
Puppet 4 Essentials - Second Edition
$ 35.99
$ 10.00
Puppet 5 Beginner's Guide - Third Edition Book Cover
Puppet 5 Beginner's Guide - Third Edition
$ 31.99
$ 10.00
DevOps: Puppet, Docker, and Kubernetes Book Cover
DevOps: Puppet, Docker, and Kubernetes
$ 79.99
$ 10.00
Mastering Puppet - Second Edition Book Cover
Mastering Puppet - Second Edition
$ 39.99
$ 10.00