Table Of Content[ 1 ]
www.it-ebooks.info
Puppet 4 Essentials
Second Edition
Acquire the skills to manage your IT infrastructure
effectively with Puppet
Felix Frank
Martin Alfke
BIRMINGHAM - MUMBAI
www.it-ebooks.info
Puppet 4 Essentials
Second Edition
Copyright © 2015 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 authors, 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: November 2014
Second edition: December 2015
Production reference: 1071215
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78588-110-7
www.packtpub.com
www.it-ebooks.info
Credits
Authors Project Coordinator
Felix Frank Shweta H Birwatkar
Martin Alfke
Proofreader
Safis Editing
Reviewer
Ger Apeldoorn
Indexer
Tejal Daruwale Soni
Acquisition Editor
Nadeem Bagban
Production Coordinator
Melwyn Dsa
Content Development Editor
Sumeet Sawant
Cover Work
Melwyn Dsa
Technical Editor
Menza Mathew
Copy Editors
Angad Singh
Alpha Singh
www.it-ebooks.info
About the Authors
Felix Frank has used and programmed computers for most of his life. During
and after working on his computer science diploma, he gained experience on the
job as a systems administrator, server operator, and open source software developer.
He spent 6 years of his 11-year career as a Puppet power user. In parallel, he spent
about two years intensifying his studies through ongoing source code contributions
and active participation in several conferences.
For making this title possible in the first place, and for their ongoing
support, I'd like to thank my editors, Nadeem Bagban and Arwa
Manasawala. Also, this book would not be what it is without the
amazing feedback from my reviewers.
For their kind feedback and ongoing support, I'd also like to thank
a number of Puppet Labs employees: Michael Smith, Peter Huene,
Josh Cooper, Andrew Parker, Adrien Thebo, Dawn Foster, Kara
Sowles, Joshua Partlow, Henrik Lindberg, Charlie Sharpsteen, Nigel
Kersten, Kylo Ginsberg, Ethan Brown, Rob Reynolds, Jeff McCune,
and Eric Sorenson. Special thanks to Luke Kanies for creating Puppet
and dedicating so many resources to this amazing community.
Further thanks go to Waltraut Niepraschk and the whole datacenter
staff at DESY Zeuthen for getting me on track with the central
management of UNIX servers. Thanks also to mpex for giving me
the opportunity to learn a lot about Puppet, and ultimately, write
this very book.
www.it-ebooks.info
Martin Alfke is co-founder and CEO of example42 GmbH. He is a Puppet and
automation enthusiast since 2007. In the past, he would have said he is a "system
administrator". Nowadays, he likes the term "infrastructure engineer". The big
difference is that system administrators sshs into systems to fix them, whereas
infrastructure engineers fix their automation.
Martin is serving as a Puppet Labs' training partner in Germany since 2011,
conducting official Puppet training. In his spare time, he likes reading books
and visiting interesting locations.
www.it-ebooks.info
About the Reviewer
Ger Apeldoorn is a freelance Puppet consultant and teaches official Puppet Labs
courses in the Netherlands. He has helped many companies implement Puppet
(both Open Source and Enterprise), and has conducted talks at PuppetConf,
PuppetCamps, FOSDEM, and other conferences. You can go through his official
website at http://puppetspecialist.nl.
www.it-ebooks.info
www.PacktPub.com
Support files, eBooks, discount offers, and more
For support files and downloads related to your book, please visit www.PacktPub.com.
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 service@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://www2.packtpub.com/books/subscription/packtlib
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
Free access for Packt account holders
If you have an account with Packt atwww.PacktPub.com, you can use this to access
PacktLib today and view 9entirely free books. Simply use your login credentials for
immediate access.
www.it-ebooks.info
www.it-ebooks.info
Table of Contents
Preface vii
Chapter 1: Writing Your First Manifests 1
Getting started 2
Introducing resources and properties 4
Interpreting the output of the puppet apply command 5
Dry-testing your manifest 7
Adding control structures in manifests 7
Using variables 9
Variable types 9
Controlling the order of evaluation 10
Declaring dependencies 12
Error propagation 15
Avoiding circular dependencies 16
Implementing resource interaction 18
Examining the most notable resource types 20
The user and group types 22
The exec resource type 23
The cron resource type 25
The mount resource type 25
Summary 26
Chapter 2: The Master and Its Agents 27
The Puppet Master 27
Puppet Master and Puppet Server 28
Setting up the master machine 29
Creating the master manifest 30
Inspecting the configuration settings 32
[ i ]
www.it-ebooks.info
Description:Puppet is a configuration management tool that allows you to automate all your IT configurations, giving you control over what you do to each Puppet Agent in a network, and when and how you do it. In this age of digital delivery and ubiquitous Internet presence, it's becoming increasingly important