Puppet: From Installation to Catalog Converge

2 hours
  • 6 Learning Objectives

About this Hands-on Lab

Jump in to the configuration management platform Puppet in this Learning Activity! Starting with installing Puppet, we aim to take you from newbie Puppet user to a competent module creator by installing and configuring Puppet Open Source, then by creating an Apache module where we’ll learn how to use resource types, add static files, create templates, use OS-specific parameters, and store data in Hiera. By the end of this learning activity, you’ll be ready to craft your own Puppet modules efficiently and with best practices.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create an `install` class

Create an install.pp manifest for the Apache class

Create a `service` class

Create a service.pp manifest for the Apache module

Create a `config` class

Create a config.pp manifest for the Apache module

Create a `vhosts` class

Create a vhosts.pp manifest for the Apache module

Create the `init.pp` file

Create an init.pp manifest that includes all previous classes

Run the Apache catalog against web1

Create a site.pp manifest for the production environment that runs the Apache class against the web1 agent

Additional Resources

Your employer has recently made the switch from another configuration management system to Puppet, and you're in the process of rewriting your end-state configurations to work with the new platform. Most paramount is the apache module, which you have been tasked with rewriting from scratch. Currently, the module must work with Red Hat, but the module should be set up with a params file so that it can quickly and easily be expanded in the future.

Since you do not currently have a Puppet testing environment, you must also install the Puppet Server and agent on the two provided servers intended for your environment. Set the Java arguments to use 512 MB RAM prior to installation.

The module requirements are as follows:

install.pp

  • Install httpd on CentOS 7 and ensure the package is present

service.pp

  • Ensure the httpd daemon is running and enabled
  • Allow for other classes to force a restart on the daemon

config.pp

  • Add the following static file to the file directory of the module:

    https://raw.githubusercontent.com/linuxacademy/content-puppetqs-nginx/learning-activity/httpd.conf
  • Ensure this file ends up at /etc/httpd/conf/httpd.conf on the agent

  • When changes are made to the file, force a restart of the httpd daemon

vhosts.pp

  • Create a virtual hosts template based on the following simple vhosts config:

    <VirtualHost *:80>
        DocumentRoot "/var/www"
        ServerName www.the-puppet-project.com
    </VirtualHost>
  • Set the port, document root, and server name to be Hiera variables

  • In the related manifest, ensure the document root exists

  • Use the server name the-puppet-project.com

init.pp

  • Ensure all classes are called
  • Ensure all variables are added to the class

When finished, add the apache module to the web1.ec2.internal server. Run a catalog converge on the agent server.

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.

Sign In
Welcome Back!

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

Get Started
Who’s going to be learning?