Book review: Puppet 2.7 Cookbook
By gildor on Friday, October 5 2012, 11:27 - Permalink
I recently read this book and it was enlightening -- that is the least I can say. It is organized into a set of recipes addressing the most common problems you have with puppet. I think the whole point is about being practical and it gives you various ways to achieve the same goal, depending if you want to do a quick and dirty hack or pick a long term solution. The whole book aims at being practical and it achieves this goal pretty well. However, it is not for beginners. Puppet itself is not for beginner and you should already have written and run into problem to really take advantage of this book.
I read the book in 5 days (only while commuting), and at each page I thought : "OMG, they do that like this" or "of course, you should use git + that" and wait impatiently coming back home to test all this stuff. The book is really about technical details and how to organize yourself to write nice Puppet classes. I have been an "irregular" user of Puppet since 4 years. I was mainly running it to distribute files on all my computers. Since 3 weeks, I am applying the recipes found in this book and it is just like discovering that you own something worth a million euros.
Let look at some example:
- Setting a value in a configuration file:
Before: Replace the whole file.
Now: Use Augeas to just change the value and don't touch to the rest of the file. The book makes me discover Augeas and it rocks !!!
- VCS repository and deployment:
Before:_ Loosy darcs repository inside /etc/ and edit directly the master.
Now: Shiny git repository in my home directory, using a Makefile to validate Puppet syntax, simulate applying it and effectively apply it to the current node before deploying it through git push.
- Installing exim4:
Before: Nothing because I didn't think it was possible.
Now: Generate a configuration file using a template, install it, run the exim4 update script and restart the service.
- Installing sshd:
Before: Copy a file and restart it.
Now: Use Augeas and a template with a loop to change what is needed for each node depending on which user I want to allow to connect on this node. Use different SSH port for every vserver that share the same IP and distribute an /etc/ssh_config to propagate the default ports set for all the vservers... (just being able to do that is worth the price of the book).
- Have a problem and try to solve it:
Before: Complain, whine and give up.
Now: Go to Puppet Forge, take inspiration for similar module, re-read part of the book, find an idea and apply it.
And so forth and so on. This book made me love puppets again. I warmly recommend it to you.