Table Of Content[ 1 ]
Puppet 5 Beginner's Guide
Third Edition
Go from newbie to pro with Puppet 5
John Arundel
BIRMINGHAM - MUMBAI
Puppet 5 Beginner's Guide
Third Edition
Copyright © 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system,
or transmitted in any form or by any means, without the prior written permission of the
publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the
information presented. However, the information contained in this book is sold without
warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers
and distributors will be held liable for any damages caused or alleged to be caused directly or
indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
First published: April 2013
Second edition: May 2017
Third edition: October 2017
Production reference: 1031017
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78847-290-6
www.packtpub.com
Credits
Author Copy Editor
John Arundel Gladson Monteiro
Reviewer Indexer
Jo Rhett Mariammal Chettiyar
Acquisition Editor Graphics
Ben Renow-Clarke Kirk D'Penha
Project Editor Production Coordinator
Alish Firasta Arvindkumar Gupta
Content Development Editor Cover Work
Monika Sangwan Arvindkumar Gupta
Technical Editors
Bhagyashree Rai
Gaurav Gavas
About the Author
John Arundel is a DevOps consultant, which means he helps people build world-
class web operations teams and infrastructure and has fun doing it. He was formerly a
senior operations engineer at global telco Verizon, designing resilient, high-performance
infrastructures for major corporations such as Ford, McDonald's, and Bank of America. He is
now an independent consultant, working closely with selected clients to deliver web-scale
performance and enterprise-grade resilience on a startup budget.
He likes writing books, especially about Puppet (Puppet 2.7 Cookbook and Puppet 3
Cookbook are available from Packt as well). It seems that at least some people enjoy reading
them, or maybe they just like the pictures. He also provides training and coaching on Puppet
and DevOps, which, it turns out, is far harder than simply doing the work himself.
Off the clock, he is a medal-winning competitive rifle and pistol shooter and a decidedly
uncompetitive piano player. He lives in a small cottage in Cornwall, England and believes,
like Cicero, that if you have a garden and a library, then you have everything you need.
You may like to follow him on Twitter at @bitfield.
Acknowledgments
My grateful thanks are due to Jo Rhett, who made innumerable improvements and
suggestions to this book, and whose Puppet expertise and clarity of writing I can only strive
to emulate. Also to the original Puppet master, Luke Kanies, who created a configuration
management tool that sucks less, and my many other friends at Puppet. Many of the key
ideas in this book came from them and others including Przemyslaw 'SoboL' Sobieski,
Peter Bleeck, and Igor Galić.
The techniques and examples in the book come largely from real production codebases, of
my consulting clients and others, and were developed with the indispensable assistance of
my friends and colleagues Jon Larkowski, Justin Domingus, Walter Smith, Ian Shaw, and Mike
Thomas. Special thanks are also due to the Perseids Project at Tufts University, and most of
all to the inestimable Bridget Almas, who patiently read and tested everything in the book
several times and made many valuable suggestions, not to mention providing continuous
moral support, love, and guidance throughout the writing process. This book is for her.
About the Reviewer
Jo Rhett is a DevOps architect with more than 25 years of experience conceptualizing
and delivering large-scale Internet services. He creates automation and infrastructure
to accelerate deployment and minimize outages.
Jo has been using, promoting, and enhancing configuration management systems for over
20 years. He builds improvements and plugins for Puppet, Mcollective, Chef, Ansible, Docker,
and many other DevOps tools.
Jo is the author of the following books:
Learning Puppet 4 by O'Reilly
Learning MCollective by O'Reilly
Instant Puppet 3 Starter by Packt Publishing
I'd like to thank the Puppet community for their never-ending inspiration
and support.
www.PacktPub.com
eBooks, discount offers, and more
Did you know that Packt offers eBook versions of every book published, with PDF and ePub
files available? You can upgrade to the eBook version at www.PacktPub.com and as a print
book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
customercare@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for
a range of free newsletters and receive exclusive discounts and offers on Packt books and
eBooks.
https://www.packtpub.com/mapt
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book
library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Customer Feedback
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial
process. To help us improve, please leave us an honest review on this book's Amazon page
at https://www.amazon.com/dp/178847290X.
If you'd like to join our team of regular reviewers, you can e-mail us at customerreviews@
packtpub.com. We award our regular reviewers with free eBooks and videos in exchange
for their valuable feedback. Help us be relentless in improving our products!
Table of Contents
Preface xi
Chapter 1: Getting started with Puppet 1
Why do we need Puppet anyway? 2
Keeping the configuration synchronized 2
Repeating changes across many servers 3
Self-updating documentation 3
Version control and history 4
Why not just write shell scripts? 4
Why not just use containers? 4
Why not just use serverless? 5
Configuration management tools 5
What is Puppet? 5
Resources and attributes 6
Puppet architectures 7
Getting ready for Puppet 7
Installing Git and downloading the repo 7
Installing VirtualBox and Vagrant 8
Running your Vagrant VM 8
Troubleshooting Vagrant 9
Summary 9
Chapter 2: Creating your first manifests 11
Hello, Puppet – your first Puppet manifest 12
Understanding the code 12
Modifying existing files 13
Dry-running Puppet 14
How Puppet applies the manifest 15
Creating a file of your own 15
[ i ]