Managing Puppet Environments with Code Manager

45 minutes
  • 5 Learning Objectives

About this Hands-on Lab

While we have a number of options for managing for Puppet environments, Code Manager is undoubtedly the most full-featured. Code Manager allows us to use Git and Git branches to define the different environments we need. We can then use a single `Puppetfile` to assign classes to our chosen environment and use the PE’s concept of environment nodes to eliminate our need for a main manifest setup.

In this hands-on lab, we will be configuring Code Manager using a remote host as our upstream Git repository. Once Code Manager is configured, we’ll then create two environments through Code Manager and assign nodes to those environments using the PE console. When finished, we’ll test our work on two provided nodes.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Set up the control repo

On the master:

Create a keypair to use with the control repository and set the owner to pe-puppet.

On the git host:

  1. Create a user for Git, called git.

  2. Switch to the new use.

  3. Create a bare control-repo repository.

  4. Create an authorized_keys file and set permissions.

On the master:

  1. Set up passwordless login to the Git host using the SSH key we have already created.

  2. Return to the cloud_user, then clone the control-repo from PuppetLabs.

  3. Add the repo on the remote host as the origin and configure Git.

  4. Create the production branch.

  5. And push the current control-repo to the remote host.

Configure Code Manager and prepare the test nodes

Start Code Manager Setup

From the PE console:

  1. Access the console at https://PUBLIC_IP_OF_MASTER, and log in as admin with a password of pinehead.

  2. Click on Classification, then select the PE Master group (found under PE Infrastructure).

  3. Select the Configuration tab. We need to update the following parameter for our puppet_enterprise::profile::master class and commit the changes when finished.

  4. Click on Nodes on the right menu, then select the puppet.ec2.interal node.

  5. Select Run Puppet…, then perform a Puppet run.

  6. Navigate to the Access control > Users page, and create a user with the Full name Code Manager and the Login of codemanager.

  7. Select the Code Manager user and click Generate password reset. Follow the link to set a password.

  8. Move to the User roles page. Assign the Code Manager user to the Code Deployers role. Commit the change.

Return to the master’s command line:

  1. Create a puppet-access token for the Code Manager user.

  2. Test that Code Manager is working.

Set Up the Dev and Production Nodes

Perform the following on each test node:

Install Puppet and then accept the certs on the Puppet master from the Unsigned certs page on the PE console.

Set up the production environment

From the master:

  1. Open the Puppetfileand add the required module.

  2. Commit the changes.

From the PE console:

  1. Select Classification from the left menu, then select Production environment from the All Environments group.

  2. Pin the prod.ec2.internal node and commit the change.

Set up development environment

From the master:

  1. Create a new branch and open the Puppetfile.

  2. Update the apache module to use the one from the Puppet Forge.

  3. Commit the changes.

From the PE console:

  1. Select Classification, then move to the Development environment.

  2. Pin the dev.ec2.internal node and commit the change.

Test the environments

From the master:

Deploy the environments.

Additional Resources

You work as a DevOps Engineer for a company that has recently decided to use Puppet Enterprise as its configuration management solution. During the trial period, your team had experimented with writing modules from scratch, and current a custom apache module is in use on a small portion of your infra. However, it has been decided that instead of investing time in custom modules, official modules from the Puppet Forge will be used. To make this transition easier — and for the ease of all future Puppet users — it has also been decided that Code Manager needs to be implemented.

You have been tasked with setting up Code Manager to use a remote Git repository located at a defined git host in your infrastructure. Once configured, ensure it works by creating the basis for your team's environment structure by setting up both production and development branches. Set up each environment to use the appropriate apache module:

  • production should use the custom module located at https://github.com/linuxacademy/content-puppet206-apache
  • development should use the PuppetLabs module found at https://forge.puppet.com/puppetlabs/apache

Ensure you test your newly-created environments by assigning the two additional nodes (prod and dev) to their respective environments. To configure these nodes for use, ensure you first run the following command:

curl -k https://puppet.ec2.internal:8140/packages/current/install.bash | sudo bash

And approve both nodes on the master.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!