Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Puppet 8 for DevOps Engineers
Puppet 8 for DevOps Engineers

Puppet 8 for DevOps Engineers: Automate your infrastructure at an enterprise scale

eBook
€17.99 €26.99
Paperback
€33.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Puppet 8 for DevOps Engineers

Puppet Concepts and Practices

This chapter will focus on the origins of Puppet, why it was created, and how it is used in DevOps engineering. It will look at Puppet’s approach to configuration management and how its declarative approach differs from more regular procedural languages. Puppet has many features that are common in other languages such as variables, conditional statements, and functions. But in this chapter, we will cover the key terms, structure, and ideas of the language that make it different and how the underlying platform runs. We will give a clear, high-level overview of its approach and how it relates to customer needs and infrastructure environments. Finally, as there are a lot of preconceptions regarding Puppet, this chapter will finish by addressing some of the most common ones, including where they come from, and unwrap them.

This should ensure a fundamental understanding of Puppet and its approach before we build up a deeper, technical understanding of the language in upcoming chapters. It will also ensure this book is not just about technology but how genuine value can be delivered to customers using the service that Puppet provides.

In this chapter, we are going to cover the following main topics:

  • Puppet’s history and relationship to DevOps
  • Puppet as a declarative and idempotent language
  • Key terms in the Puppet language
  • Puppet as a platform
  • Common misconceptions

Puppet’s history and relationship to DevOps

Puppet was started by creator and founder Luke Kanies, who was working as a sysadmin and consultant. He was unable to find the tooling he wanted to use and that his customers could rely on, so he created Puppet as a Ruby-based open source configuration management language in 2005. The success of this open source project resulted in the release of a commercial offering, Puppet Enterprise, in February 2011. But as the demands increased and Puppet needed to reform and expand as both a company and an open source project, Luke stood down, stating that the challenges of growing Puppet to enterprise-scale were far from what I love to do most, and far from my core skills. We need to scale, and we need to execute.

The new leadership that followed took a direction that saw the company develop its professional services, and focus more effort on developer tooling and education while expanding its product range both organically and via acquisitions, striking a difficult balance between the open source community and its enterprise customer demands. Puppet was acquired by Perforce Software on May 17, 2022, following the Chef (2020) and Ansible (2015) acquisitions, as the last of the standalone configuration management start-ups. Luke summed up the change that has taken place in the industry: DevOps teams are different now. Companies are looking for a complete solution, rather than wanting to integrate individual best-of-breed vendors.

This history has seen Puppet move from a tool that left it to the developer to decided how best to use it to solve problems to, today, a tool with patterns and solutions that users can just consume to standardize their automation and deployment. This has allowed users to focus on their solutions and not the underlying technology.

DevOps itself has become a frustrating term in the IT industry; the definition given by formal sources differs hugely from how companies actually use it, and references to it can be used as a cynical buzzword or sales gimmick. The focus of this book is on DevOps engineering, as used particularly by large companies and has been well researched and discussed in studies such as the Puppet-run State of DevOps Report. DevOps engineering is normally delivered as part of projects such as digital transformations, cloud-first migrations, and various other modernization projects. What is typically seen in these projects is a desire to automate self-service deployment, compliance, and remove toil. This approach follows the DevOps goal of breaking down the silos between developers and ops teams by allowing better communication and establishing shared goals. What is noticeable is that the system administrator role in which Luke worked originally has effectively been replaced by roles such as DevOps engineers.

Puppet will be used as part of a DevOps toolchain, and Figure 1.1 shows an example set of tools and their relative functions. It is typical for Puppet to start its role at the end of a provisioning pipeline, as infrastructure is stood up in a platform and needs to be configured and enforced:

Figure 1.1 – A DevOps toolset

Figure 1.1 – A DevOps toolset

This book will focus not just on a technological understanding but also on how to use the maturity of the Puppet language, tooling, and platform with opinionated patterns. These approaches have been developed through years of customer engagements for Puppet and the communities’ own implementations to allow users to reduce their effort in finding the right approach, focus on their solutions, and deliver immediate benefit and return to their customers.

Puppet as a declarative and idempotent language

The first important thing to understand is how Puppet differs from normal scripting or coding languages. Puppet is declarative, meaning you describe the state you want the system to be in. For example, you could describe that your system should have a user called username with UID 1234, a configuration file should not exist, and a kernel setting should be at a particular value. In comparison to most languages where you have to describe the process to get to the state, Puppet’s approach brings us closer to how customers request services. They don’t want to know how it’s done, just that it will meet their requirements. These resource definitions can be saved in your version control system. Often, this approach is described as being part of Infrastructure as Code.

Puppet is idempotent, meaning that it will only make the changes required to get into the declared state. Meanwhile, most procedural languages will run steps every time and, typically, require various checks such as if statements to be added to make checks to avoid duplication. This is particularly powerful as what is called enforcement can be run with the Puppet language, ensuring the state you declared has been reached, and is capable of detecting whether a change happened because of you updating the state you wished the machine to be in or whether it was a change that happened on the machine itself moving away from the desired state. This can greatly assist with audits and avoid any configuration drifts in an estate and ensure change is managed and deliberate.

Puppet is OS-independent; the language is focused on the state, not the underlying implementation of how particular OSes install a package or add a user. This gives us a universal language that is independent of any underlying implementations, allowing for less duplication of code, avoiding the need to use layers of case/if statements to detect differences, and allowing multiple language implementations such as PowerShell for Windows and Bash for Unix-based systems. Additionally, it makes it easier to recover after failures in applying code. If in a procedural language, a step fails, it might not be safe to run the script in full again depending on how well the check steps have been coded. In contrast, Puppet code is able to resume only performing the steps it needs to reach the correct state.

A simple example of Puppet code to create a user would look like this:

user { 'david'
  uid => '123'
}

In contrast, a shell script might have a section like this:

if ! getent passwd david; then
  useradd -u 123 david
elif ! $(uid david) == 123; then
  usermod -u 123 david
fi

In the preceding shell example, we have to check whether a user exists, and if not, create one. If it does exist, then does it have the right UID? If not, we change it. This script only covers OSes that can use useradd and usermod. To achieve compatibility with multiple OSes, we would need a test to detect the OS type and produce a section of code like this for every OS or group of OSes and their required commands. Often, it would be more practical to write in multiple languages and scripts to cover a broader base of OS flavors, that is, if we wanted to cover both Unix and Windows, for example.

This compares to the Puppet declaration, which will work on multiple OSes without change as Puppet will detect the required commands and perform all the necessary state checks as part of that.

This example is all just for a single resource with a single attribute. You can quickly see how the shell script example will not scale as it becomes increasingly complex with almost endless checks and options.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Understand the core concepts and best approaches to the latest version of the Puppet language
  • Learn the key components of the Puppet platform and see how they deploy and apply Puppet code to infrastructure
  • Discover approaches to collaborative working by using the right structure of code and deployment

Description

As DevOps and platform engineering drive the demand for robust internal development platforms, the need for infrastructure configuration tools has never been greater. Puppet, a powerful configuration management tool, is widely used by leading enterprises and boasts a thriving open source community. This book provides a comprehensive explanation of both the Puppet language and the platform. It begins by helping you grasp the basic concepts and approach of Puppet as a stateful language, and then builds up to explaining how to structure Puppet code to scale and allow flexibility and collaboration among teams. As you advance, you’ll find out how the Puppet platform allows the management and reporting of infrastructure configuration. The book also shows you how the platform can be integrated with other tooling, such as ServiceNow and Splunk. The concluding chapters help you implement Puppet to fit in heavily regulated and audited environments as well as modern hybrid cloud environments. By the end of this book, you’ll have gained a solid understanding of the capabilities of both the Puppet language and platform, and you will have learned how to structure and scale Puppet to create a platform to provide enterprise-grade infrastructure configuration.

Who is this book for?

This book is for DevOps engineers looking to automate infrastructure with Puppet as a configuration management tool. It will allow both beginners and current Puppet users to understand the full power of the Puppet language and platform. A basic understanding of Unix system administration and Windows systems and core development concepts such as revision control tools like git, virtualization, testing, and coding tooling like vi or Visual Studio code is a prerequisite.

What you will learn

  • Find out how to structure Puppet code and data to scale and be secure
  • Discover the core components of the Puppet platform and how to achieve performance
  • Get to grips with classifying infrastructure and deploying code for different environments
  • Understand how Bolt can provide procedural orchestration alongside Puppet code
  • Use Puppet's integrations and Forge modules that allow Puppet to integrate with other systems
  • Adopt approaches to adoption to ensure your Puppet implementation will succeed in regulated environments, the cloud, and with change control

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 28, 2023
Length: 416 pages
Edition : 1st
Language : English
ISBN-13 : 9781803231709
Concepts :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Jun 28, 2023
Length: 416 pages
Edition : 1st
Language : English
ISBN-13 : 9781803231709
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 113.97
Puppet 8 for DevOps Engineers
€33.99
Mastering Kubernetes
€41.99
Terraform Cookbook
€37.99
Total 113.97 Stars icon

Table of Contents

21 Chapters
Part 1 – Introduction to Puppet and the Basics of the Puppet Language Chevron down icon Chevron up icon
Chapter 1: Puppet Concepts and Practices Chevron down icon Chevron up icon
Chapter 2: Major Changes, Useful Tools, and References Chevron down icon Chevron up icon
Chapter 3: Puppet Classes, Resource Types, and Providers Chevron down icon Chevron up icon
Chapter 4: Variables and Data Types Chevron down icon Chevron up icon
Chapter 5: Facts and Functions Chevron down icon Chevron up icon
Part 2 – Structuring, Ordering, and Managing Data in the Puppet Language Chevron down icon Chevron up icon
Chapter 6: Relationships, Ordering, and Scope Chevron down icon Chevron up icon
Chapter 7: Templating, Iterating, and Conditionals Chevron down icon Chevron up icon
Chapter 8: Developing and Managing Modules Chevron down icon Chevron up icon
Chapter 9: Handling Data with Puppet Chevron down icon Chevron up icon
Part 3 – The Puppet Platform and Bolt Orchestration Chevron down icon Chevron up icon
Chapter 10: Puppet Platform Parts and Functions Chevron down icon Chevron up icon
Chapter 11: Classification and Release Management Chevron down icon Chevron up icon
Chapter 12: Bolt for Orchestration Chevron down icon Chevron up icon
Chapter 13: Taking Puppet Server Further Chevron down icon Chevron up icon
Part 4 – Puppet Enterprise and Approaches to the Adoption of Puppet Chevron down icon Chevron up icon
Chapter 14: A Brief Overview of Puppet Enterprise Chevron down icon Chevron up icon
Chapter 15: Approaches to Adoption Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8
(5 Ratings)
5 star 80%
4 star 20%
3 star 0%
2 star 0%
1 star 0%
Tiny Aug 19, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
A good intoduction to Puppet although I wish the Puppet 8 approaches were a little better integrated into the text of the book. I found the section on Bolt, as an agentless orchestrator to work in connection with Puppet to particularly helpful. Also nice was having a lab section rather than merely questions at the end of the chapter to help bring up one's own browser and move forward.
Amazon Verified review Amazon
Robert Waffen Jul 11, 2023
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Dieses Buch hilft einem gut dabei in Puppet einzusteigen. Es vermittelt einen die Grundkonzepte und erklärt diese immer anschaulich an Code-Beispielen. Für Menschen die von früheren Puppet Versionen umsteigen zeigt es gut die Änderungen dieser bis hin zu Puppet 8 auf. Der Schreibstil ist auch sehr angenehm zu lesen und die Sätze sind nicht überkompliziert gestaltet, wie es z.B. in so manch anderem Fachbuch oft vorkommt.Mir hat es sehr gefallen und ich kann es empfehlen.Als Kritik muss ich aber leider noch äussern, das die abgedruckten Code-Beispiele oft gegen den Puppet-eigenen Code-Guideline verstoßen und etwas zusammengewürfelt wirken. Diese hätten echt ein wenig mehr Liebe gebraucht. Auch sind hier und da einige kleine Syntax-Fehler zu finden. Was aber nicht deren Zweck, etwas zu veranschaulichen mindert.--- EnglishThis book is very helpful for getting started with Puppet. It conveys the basic concepts and explains them using code examples that are always presented in a clear manner. For people transitioning from earlier versions of Puppet, it effectively highlights the changes up to Puppet 8. The writing style is also very pleasant to read, and the sentences are not overly complicated, which is often the case in other technical books.I really enjoyed it and can recommend it.However, as a criticism, I have to mention that the printed code examples often violate Puppet's own code guidelines and seem somewhat haphazardly put together. They could have used a bit more attention to detail. Additionally, there are some minor syntax errors here and there. However, this doesn't diminish their purpose of illustrating concepts.
Amazon Verified review Amazon
Aaron Russo Jul 05, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book covers a wide range of topics from puppet architecture to testing and most things in between, and found it to be a good book on current Puppet to introduce its concepts and ideas to my team of mostly new Puppet users, as well as being a reference for more experienced users.NOTE: My initial review was a bit critical of the Puppet 8 references being a bit inconsistent, but sounds like that was a publishing issue and new copies purchased have fixed that.
Amazon Verified review Amazon
Nick Moore Jul 05, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Puppet is by far and away the most powerful automation tool on the market. With great power comes great responsibility! This book is a must for any DevOps engineers who want to spend their time working on the fun parts of their jobs, whilst automating away the pain via Puppet technology. Fantastically written, by someone who grew up in the financial industry using Puppet. Some very good tips and lessons learned that even seasoned Puppet veterans could learn from. Five stars.
Amazon Verified review Amazon
ps258 Jun 29, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Absolutely the best Puppet book I've ever owned or read.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.