Table Of ContentExtending Puppet
Design, manage, and deploy your Puppet architecture
with the help of real-world scenarios
Alessandro Franceschi
BIRMINGHAM - MUMBAI
Extending Puppet
Copyright © 2014 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: June 2014
Production reference: 1170614
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-144-1
www.packtpub.com
Cover image by Alessandro Franceschi (alvagante@yahoo.it)
Credits
Author Project Coordinator
Alessandro Franceschi Kartik Vedam
Reviewers Proofreaders
Dhruv Ahuja Simran Bhogal
C. N. A. Corrêa Maria Gould
Brice Figureau Ameesha Green
Paul Hindle
Commissioning Editor
Edward Gordon
Indexer
Hemangini Bari
Acquisition Editor
Llewellyn Rozario
Production Coordinator
Adonia Jones
Content Development Editor
Azharuddin Sheikh
Cover Work
Adonia Jones
Technical Editors
Rohit Kumar Singh
Pratish Soman
Copy Editors
Sayanee Mukherjee
Karuna Narayanan
Alfida Paiva
Adithi Shetty
Laxmi Subramanian
Foreword
I first met Alessandro in person at the inaugural Puppet Camp in San Francisco,
2009, but by this time, we'd already chatted on IRC and the Puppet Users mailing
list. This was a small event by the standards of Puppet community events today,
with about 60 people in attendance, and it's been great to see how many of that
original crowd have continued to be active participants in the community,
especially Alessandro.
While I was running Puppet at Google, I kept getting a lot of questions from
attendees about how we were managing to scale our Puppet infrastructure
technically. Alessandro, however, was already prodding me about how I was
managing workflow and code layout for reusability and shareability, a topic
that he's been very much focused on over the last five years.
When I initially left Google and moved to Puppet Labs in late 2010 to handle
products, it became even more apparent how much Alessandro cared about guiding
the community towards standards for Puppet content that allowed for reusability
and shareability, yet allowed sysadmins to work quickly. We saw this with his
promotion of the "params pattern" to consolidate input variables in a single location,
and to allow for a first step towards separating data from code, well before the
existence of Hiera as a formal project.
Alessandro saw this need well before most of us, and regularly raised it with the
community as well as just about every time we ran into each other at conferences
and events. As new projects appeared that added to the capabilities of the Puppet
ecosystem, he modified his thinking and raised new proposals.
I'm thrilled to see this new book by Alessandro on Puppet architectures and
design patterns, and I can't think of a better person to write it. He's cared about
these principles for a long time, and he's promoted them as a responsible
community member.
Nigel Kersten
CIO, Puppet Labs
About the Author
Alessandro Franceschi is a freelance Puppet and DevOps consultant. Surviving
IT battlegrounds since 1995, he has worked as an entrepreneur, web developer,
trainer, and system and network administrator.
He has been using Puppet since 2007, automating a remarkable amount of customers'
infrastructures of different sizes, natures, and complexities.
He has attended several PuppetConf and Puppet Camps as a speaker and
participant, always enjoying the vibrant and friendly community, learning
something new each time.
During the following years, he started to publish his Puppet code, trying to make it
reusable in different scenarios.
The result of this work is the Example42 Puppet modules set, a widely used
collection of modules based on reusability principles and with some optional,
opinionated twists to automate firewalling, monitoring, systems' inventory, and
application deployments.
For more information on Example42 modules, visit www.example42.com. His Twitter
handle is @alvagante.
Acknowledgments
This is my first book. When Packt Publishing asked me to write a book about Puppet,
I was surprised, flattered, and intrigued. The idea of sharing my experience about
this wonderful tool was really attractive.
I have been using Puppet for seven years. I have loved it since the beginning.
I have seen a great community of people doing wonderful things with it, and I tried
to credit as many people as possible, knowing that many worthy contributors have
been forgotten.
I have assisted in its evolution and the tumultuous growth of the company behind it,
Puppet Labs.
I have definitely not seen any attack ships on fire off the shoulder of Orion, but I
think I have gathered enough experience about Puppet to have valuable things to
write about and share.
Please forgive my approximate grasp of the language; if you are a native English
speaker, you will surely find some sentences weird or just wrong.
I tried to avoid the temptation to build phrases based on my mother language
constructs; I believe I have failed in more than one place.
Various people have helped me with suggestions and corrections; they couldn't solve
all my language idiosyncrasies and content limitations, but their input has been very
important to make this book better.
I'd like to thank in particular Brice Figureau, Joshua Hoblitt, and Azharuddin Sheikh
for the invaluable help and corrections, and Nigel Kersten, Jon Forrest, Calogero
Bonasia, Monica Colangelo, and Kartik Vedam for the precious suggestions.
A big hug to Chiara, who is always patient and supportive, and to all my family,
even the younger one who is extremely skilled in kicking me out of the bed,
encouraging early morning writing sessions.
It's time to enjoy some more weekends together, finally.
About the Reviewers
Dhruv Ahuja is a senior DevOps engineer at a leading financial data vendor.
He specializes in orchestration and configuration management in an enterprise,
heterogeneous setting. His first brush with Puppet was in 2011 when he developed
a solution for dynamically scaling compute nodes for a multipurpose grid platform.
He also holds a Master's degree in Advanced Software Engineering from King's
College London, and won the Red Hat UK Channel Consultant of the Year award in
2012 for delivering progressive solutions. A long history in conventional software
development and traditional systems administration equip him with aptness in both
areas. In this era of infrastructure as code, he believes that declarative abstraction is
essential for a maintainable systems life-cycle process.
C. N. A. Corrêa (@cnacorrea) is an IT operations manager and consultant, and is
also a Puppet enthusiast and an old-school Linux hacker. He has a Master's degree
in Systems Virtualization and holds CISSP and RHCE certifications. Backed by
a 15-year career in systems administration, Carlos leads the IT operations teams
for companies in Brazil, Africa, and the USA. He is also a part-time professor for
graduate and undergraduate courses in Brazil. Carlos has co-authored several
research papers on network virtualization and OpenFlow, and has presented at
peer-reviewed IEEE and ACM conferences worldwide.
I thank God for all the opportunities of hard work and all the lovely
people I always find on my way. To the sweetest of them all, my
wife Nanda, I thank for all the loving care and support that pushes
me forward. Also, to my parents, Nilton and Zélia, for being such a
big inspiration for all the things I do.
Brice Figureau works at Days of Wonder, a board game publisher best known
for its award-winning train game Ticket to Ride, where he designs, manages, and
programs distributed online game servers and the infrastructure they run on.
In several previous job roles, he programmed 3D-rendering engines, Photoshop
plugins, early mobile Internet services, and voice-recognition-based phone services
and learned system administration. He likes to spend time contributing to various
open source projects and has started some of his own. He's been using Puppet since
Version 0.23.7 and contributed several major features to the Puppet core code that
helped make Puppet what it is now. He also maintains www.planetpuppet.org and
helps to organize the Paris DevOps Meetups and the DevopsDays Paris conference
when time permits. You might find him hanging around in IRC under the masterzen
nickname on Twitter with the @_masterzen_ handle, or at different open source,
DevOps, or Configuration Management conferences around the world.