Book Image

Puppet 8 for DevOps Engineers

By : David Sandilands
Book Image

Puppet 8 for DevOps Engineers

By: David Sandilands

Overview of this book

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.
Table of Contents (22 chapters)
1
Part 1 – Introduction to Puppet and the Basics of the Puppet Language
7
Part 2 – Structuring, Ordering, and Managing Data in the Puppet Language
12
Part 3 – The Puppet Platform and Bolt Orchestration
17
Part 4 – Puppet Enterprise and Approaches to the Adoption of Puppet

Lab – use eyaml to store a secret

In this lab, the puppet-hiera_eyaml module has been used to set up eyaml with default pkcs keys, with a global Hiera setup to look at the node name, OS, and common values. In site.pp, a Hiera lookup is performed to look up the value of secret::examplefiles, which is used as content to create a /var/tmp/secret_example file on the Puppet primary server. The lookup has a default of not set. In this lab, you will encrypt a secret and add it within the OS level so the content of the file changes.

SSH to the primary server and elevate to root:

ssh centos@<primary_host>
sudo su -

Run the eyaml encrypt –p command from within the /etc/puppetlabs/puppet directory and enter a secret of your choice at the prompt:

cd /etc/puppetlabs/puppet
eyaml encrypt -p

Copy the output after the string starting with ENC[ and paste it into the data section at /etc/puppetlabs/puppet/data/os/RedHat.eyaml so it contains something like this:

...