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
Extending Puppet Rating: 0 out of 5 stars0 ratingsAdapting Configuration Management for Agile Teams: Balancing Sustainability and Speed Rating: 0 out of 5 stars0 ratingsPaaS Mastery: Platform As A Service: Your All-In-One Guide To Azure Pipelines, Google Cloud, Microsoft Azure, And IBM Cloud Rating: 0 out of 5 stars0 ratingsJIRA 6.x Administration Cookbook Rating: 0 out of 5 stars0 ratingsMastering DevOps in Kubernetes: Maximize your container workload efficiency with DevOps practices in Kubernetes (English Edition) Rating: 0 out of 5 stars0 ratingsPuppet 4 Essentials - Second Edition Rating: 0 out of 5 stars0 ratingsPuppet 4.10 Beginner’s Guide - Second Edition Rating: 0 out of 5 stars0 ratingsExpert Python Programming - Second Edition Rating: 2 out of 5 stars2/5Troubleshooting Puppet Rating: 0 out of 5 stars0 ratingsMastering Puppet - Second Edition Rating: 0 out of 5 stars0 ratingsObject–Oriented Programming with Swift 2 Rating: 0 out of 5 stars0 ratingsPython: Journey from Novice to Expert Rating: 5 out of 5 stars5/5Mastering IPython 4.0 Rating: 0 out of 5 stars0 ratingsLearning Puppet for Windows Server Rating: 0 out of 5 stars0 ratingsPython Essentials Rating: 5 out of 5 stars5/5Python: Real-World Data Science Rating: 0 out of 5 stars0 ratingsOdoo 10 Development Essentials Rating: 0 out of 5 stars0 ratingsDesigning Deep Learning Systems: A software engineer's guide Rating: 0 out of 5 stars0 ratingsProfessional Plone 4 Development Rating: 3 out of 5 stars3/5Advanced Penetration Testing for Highly-Secured Environments: The Ultimate Security Guide Rating: 5 out of 5 stars5/5Learning Puppet Security Rating: 0 out of 5 stars0 ratingsMastering KnockoutJS Rating: 0 out of 5 stars0 ratingsLearning Python Rating: 5 out of 5 stars5/5OpenStack Trove Essentials Rating: 0 out of 5 stars0 ratingsGetting Started with Julia Rating: 0 out of 5 stars0 ratingsLarge Scale Machine Learning with Python Rating: 2 out of 5 stars2/5Distributed and Cloud Computing: From Parallel Processing to the Internet of Things Rating: 5 out of 5 stars5/5Modular Programming with Python Rating: 0 out of 5 stars0 ratingsMaster Python Without Prior Experience Rating: 0 out of 5 stars0 ratings
Operating Systems For You
Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5PowerShell: A Comprehensive Guide to Windows PowerShell Rating: 4 out of 5 stars4/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Linux Bible Rating: 0 out of 5 stars0 ratingsHacking : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Ethical Hacking Rating: 5 out of 5 stars5/5Linux All-in-One For Dummies Rating: 3 out of 5 stars3/5iPad and iPad Pro For Dummies Rating: 0 out of 5 stars0 ratingsWindows 11 All-in-One For Dummies Rating: 5 out of 5 stars5/5CompTIA Linux+ Study Guide: Exam XK0-004 Rating: 0 out of 5 stars0 ratingsOperating Systems DeMYSTiFieD Rating: 0 out of 5 stars0 ratingsThe Windows Command Line Beginner's Guide: Second Edition Rating: 4 out of 5 stars4/5Mastering Windows PowerShell Scripting Rating: 4 out of 5 stars4/5Tor Darknet Bundle: Master the Art of Invisibility Rating: 0 out of 5 stars0 ratingsWindows Server 2019 & PowerShell All-in-One For Dummies Rating: 0 out of 5 stars0 ratingsExploring Windows 11: The Illustrated, Practical Guide to Using Microsoft Windows Rating: 0 out of 5 stars0 ratingsLinux for Beginners: Linux Command Line, Linux Programming and Linux Operating System Rating: 4 out of 5 stars4/5Linux Command Line and Shell Scripting Bible Rating: 3 out of 5 stars3/5Make Your PC Stable and Fast: What Microsoft Forgot to Tell You Rating: 4 out of 5 stars4/5Learn SQL Server Administration in a Month of Lunches Rating: 3 out of 5 stars3/5Linux Networking Cookbook Rating: 0 out of 5 stars0 ratingsOneNote: The Ultimate Guide on How to Use Microsoft OneNote for Getting Things Done Rating: 1 out of 5 stars1/5Raspberry Pi Cookbook for Python Programmers Rating: 0 out of 5 stars0 ratingsBash Command Line Pro Tips Rating: 5 out of 5 stars5/5Learn Windows PowerShell in a Month of Lunches Rating: 0 out of 5 stars0 ratingsThe Mac Terminal Reference and Scripting Primer Rating: 4 out of 5 stars4/5iPhone Unlocked Rating: 0 out of 5 stars0 ratingsLinux Command-Line Tips & Tricks Rating: 0 out of 5 stars0 ratingsWindows 11 For Dummies Rating: 0 out of 5 stars0 ratings
Reviews for Extending Puppet - Second Edition
0 ratings0 reviews
Book preview
Extending Puppet - Second Edition - Alessandro Franceschi
www.packtpub.com/authors.
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 <copyright@packtpub.com> 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 <questions@packtpub.com>, 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