Extending Puppet - Second Edition
()
About this ebook
- Explore the wider Puppet ecosystem of useful tools
- Design and manage your Puppet architecture for optimum performance
- Write more efficient code that keeps your infrastructure more robust
If you are a Puppet user, this book will help you on different levels. If you are a beginner, we summarize the key Puppet components and give you the elements to have a broader vision. For more experienced users, we provide topics on designing, implementing, adapting, and deploying Puppet architectures. If you are an expert, you will find topics and information that is rarely exposed in other books, giving you an insight into Puppet's future and its usage on alternative devices.
Related to Extending Puppet - Second Edition
Related ebooks
Learning Ansible Rating: 0 out of 5 stars0 ratingsOpenStack Administration with Ansible 2 - Second Edition Rating: 0 out of 5 stars0 ratingsLearning SaltStack - Second Edition Rating: 0 out of 5 stars0 ratingsUnix / Linux FAQ: with Tips to Face Interviews Rating: 0 out of 5 stars0 ratingsAnsible For Security by Examples Rating: 0 out of 5 stars0 ratingsDevOps in the Enterprise Complete Self-Assessment Guide Rating: 0 out of 5 stars0 ratingsMastering OpenStack Rating: 1 out of 5 stars1/5Production Ready OpenStack - Recipes for Successful Environments: Production Ready OpenStack - Recipes for Successful Environments Rating: 0 out of 5 stars0 ratingsIndustrial Project Management Decoded: Things I Wish My Boss Would Have Told Me Rating: 0 out of 5 stars0 ratingsLearning Nagios - Third Edition Rating: 0 out of 5 stars0 ratingsKubernetes A Complete Guide Rating: 0 out of 5 stars0 ratingsAI Explained: Uncovering the Reality, Risks, and Rewards of Artificial Intelligence Rating: 0 out of 5 stars0 ratingsAnsible by Examples: 200+ Automation Examples For Linux and Windows System Administrators and DevOps Rating: 0 out of 5 stars0 ratingsRHCSA Exam Pass: Red Hat Certified System Administrator Study Guide Rating: 0 out of 5 stars0 ratingsSpring Boot 3.0 Crash Course Rating: 0 out of 5 stars0 ratingsAnsible For Containers and Kubernetes By Examples Rating: 0 out of 5 stars0 ratingsMastering SaltStack - Second Edition Rating: 0 out of 5 stars0 ratingsOpen-Source Middleware Suites A Complete Guide Rating: 0 out of 5 stars0 ratingsKubernetes and Cloud Native Associate (KCNA) Exam Preparation Rating: 0 out of 5 stars0 ratingsMastering Ceph Rating: 0 out of 5 stars0 ratingsOpenShift Cookbook Rating: 0 out of 5 stars0 ratingsRed Hat RHCE 8 (EX294) Capsules: Certification Guide Rating: 0 out of 5 stars0 ratingsMastering Kubernetes: From Basics to Expert Proficiency Rating: 0 out of 5 stars0 ratingsImplementing GitOps with Kubernetes: Automate, manage, scale, and secure infrastructure and cloud-native applications on AWS and Azure Rating: 0 out of 5 stars0 ratings
Operating Systems For You
Android Development With Kotlin: Novice To Ninja Rating: 0 out of 5 stars0 ratingsLinux Bible Rating: 0 out of 5 stars0 ratingsSDL Trados Studio – A Practical Guide Rating: 5 out of 5 stars5/5LPIC-1 Linux Professional Institute Certification Study Guide: Exam 101-500 and Exam 102-500 Rating: 0 out of 5 stars0 ratingsGo Programming - From Beginner to Professional: Learn everything you need to build modern software using Go Rating: 0 out of 5 stars0 ratingsWindows Server 2019 & PowerShell All-in-One For Dummies Rating: 0 out of 5 stars0 ratingsPowerShell: A Beginner's Guide to Windows PowerShell Rating: 4 out of 5 stars4/5MacBook Pro User Manual: 2022 MacBook Pro User Guide for beginners and seniors to Master Macbook Pro like a Pro Rating: 0 out of 5 stars0 ratingsiCloud for Beginners: A Ridiculously Simple Guide to Online Storage Rating: 0 out of 5 stars0 ratingsSwift iOS Programming for Kids Rating: 0 out of 5 stars0 ratingsMastering Bash Rating: 5 out of 5 stars5/5ICloud :The Comprehensive Guide To Apple iCloud Rating: 0 out of 5 stars0 ratingsThe iPad Pro for Seniors: A Ridiculously Simple Guide To the Next Generation of iPad and iOS 12 Rating: 5 out of 5 stars5/5M2 Mac Book Air User Guide: Features, Tips, and Tricks With Pictures Rating: 0 out of 5 stars0 ratingsWindows 11 For Dummies, 2nd Edition Rating: 0 out of 5 stars0 ratingsWindows 10: A Complete Guide to Using Windows 10 Rating: 0 out of 5 stars0 ratingsRed Hat RHCE 9 (EX294) Capsules: Certification Guide Rating: 0 out of 5 stars0 ratingsPractical Digital Forensics Rating: 0 out of 5 stars0 ratingsDecode the iPhone 16 and iPhone 16 Pro: A Simple Guide to the 2024 iPhone and iOS 18 Rating: 0 out of 5 stars0 ratingsMastering Ubuntu Server Rating: 5 out of 5 stars5/5Decode the iPhone 16e: A Simple Guide to the 2025 iPhone 16e and iOS 18 Rating: 0 out of 5 stars0 ratings
Reviews for Extending Puppet - Second Edition
0 ratings0 reviews
Book preview
Extending Puppet - Second Edition - Alessandro Franceschi
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at <[email protected]>, and we will do our best to address the problem.
Chapter 1. Puppet Essentials
There are moments in our professional life when we meet technologies that trigger an inner wow effect. We realize there's something special in them and we start to wonder how they can be useful for our current needs and, eventually, wider projects. Puppet, for me, has been one of these turning point technologies. I have reason to think that we might share a similar feeling.
If you are new to Puppet, you are probably starting from the wrong place, there are better fitting titles around to grasp its basic concepts.
This book won't indulge too much on the fundamentals, but don't despair, this chapter might help for a quick start. It provides the basic Puppet background needed to understand the rest of the contents and may also offer valuable information to more experienced users.
We are going to review the following topics:
The Puppet ecosystem, its components, history, and the basic concepts behind configuration management
How to install and configure Puppet commands and paths, to understand where things are placed
The core components and concepts; terms such as manifests, resources, nodes, and classes will become familiar
The main language elements—variables, references, resources defaults, ordering, conditionals, comparison operators, virtual and exported resources
How Puppet stores the changes it makes and how to revert them
The contents of this chapter are quite dense, so take your time to review and assimilate them if they sound new or look too complex; the path towards Puppet awareness is never too easy.
The Puppet ecosystem
Puppet is a configuration management and automation tool; we use it to install, configure, and manage components of our servers.
Initially written in Ruby, some parts were rewritten in version 4 in Clojure. Released with an open source license (Apache 2), it can run on any Linux distribution, many other UNIX variants (Solaris, *BSD, AIX, and Mac OS X), and Windows. Its development started in 2005 by Luke Kanies as an alternative approach to the existing configuration management tools (most notably CFEngine and BladeLogic). The project has grown year after year; Kanies' own company, Reductive Labs, renamed in 2010 to Puppet Labs, has received a total funding of $ 45.5 million in various funding rounds (among the investors there are names such as VMware, Google, and Cisco).
Now, it is one of the top 100 fastest growing companies in the US. It employs more than 150 people and it has a solid business based on open source software, consisting of consulting services, training, certifications, and Puppet Enterprise. Puppet Enterprise is the commercial version that is based on the same open source Puppet codebase, but it provides an integrated stack with lots of tools, such as a web GUI that improves and makes Puppet usage and administration easier, and more complete support for some major Linux distributions, Mac OS X, and Microsoft Windows Server.
The Puppet ecosystem features a vibrant, large, and active community, which discusses on the Puppet Users and Puppet Developers Google groups, on the crowded free node #puppet IRC channel, at the various Puppet Camps that are held multiple times a year all over the world, and at the annual PuppetConf, which is improving and getting bigger year after year.
Various software products are complementary to Puppet; some of them are developed by Puppet Labs:
Hiera: This is a key-value lookup tool that is the current choice of reference for storing data related to our Puppet infrastructure.
Mcollective: This is an orchestration framework that allows parallel execution of tasks on multiple servers. It is a separate project by Puppet Labs, which works well with Puppet.
Facter: This is a required complementary tool; it is executed on each managed node and gathers local information in key/value pairs (facts), which are used by Puppet.
Geppetto: This is an IDE, based on Eclipse that allows easier and assisted development of Puppet code.
Puppet Dashboard: This is an open source web console for Puppet.
PuppetDB: This is a powerful backend that can store all the data gathered and generated by Puppet.
Puppet Enterprise: This is the commercial solution to manage via a web frontend Puppet, Mcollective, and PuppetDB.
The community has produced other tools and resources. The most noticeable ones are:
The Foreman: This is a systems lifecycle management tool that integrates perfectly with Puppet.
PuppetBoard: This is a web front end for PuppetDB.
Kermit: This is a web front end for Puppet and Mcollective.
Modules: These are reusable components that allow management of any kind of application and software via Puppet.
Why configuration management matters
IT operations have changed drastically in the past few years. Virtualization, cloud, business needs, and emerging technologies have accelerated the pace of how systems are provisioned, configured, and managed.
The manual setup of a growing number of operating systems is no longer a sustainable option. At the same time, in-house custom solutions to automate the installation and the management of systems cannot scale in terms of required maintenance and development efforts.
For these reasons, configuration management tools such as Puppet, Chef, CFEngine, Rudder, Salt, and Ansible (to mention only the most known open source ones) are becoming increasingly popular in many infrastructures.
They show infrastructure as code, that allows, in systems management, the use of some of the same best practices in software development for decades, such as maintainability, code reusability, testability, or version control.
Once we can express the status of our infrastructure with versioned code, there are powerful benefits:
We can reproduce our setups in a consistent way, what is executed once can be executed any time, the procedure to configure a server from scratch can be repeated without the risk of missing parts
Our code commits log reflects the history of changes on the infrastructure; who did what, when, and if commits comments are pertinent, why.
We can scale quickly; the configurations we made for a server can be applied to all the servers of the same kind.
We have aligned and coherent environments; our Development, Test, QA, Staging, and Production servers can share the same setup procedures and configurations.
With these kinds of tools, we can have a system provisioned from zero to production in a few minutes, or we can quickly propagate a configuration change over our whole infrastructure automatically.
Their power is huge and has to be handled with care; as we can automate massive and parallelized setups and configurations of systems; we might automate distributed destructions.
With great power comes great responsibility.
Puppet components
Before diving into installation and configuration details, we need to clarify and explain some Puppet terminology to get the whole picture.
Puppet features a declarative Domain Specific Language (DSL), which expresses the desired state and properties of the managed resources.
Resources can be any component of a system, for example, packages to install, services to start, files to manage, users to create, and also custom and specific resources, such as MySQL grants, Apache virtual hosts, and so on.
Puppet code is written in manifests, which are simple text files with a .pp extension. Resources can be grouped in classes (do not consider them classes as in OOP, they aren't). Classes and all the files needed to define the configurations required are generally placed in modules, which are directories structured in a standard way that are supposed to manage specific applications or system's features (there are modules to manage Apache, MySQL, sudo, sysctl, networking, and so