SMBs

Learn how to use Puppet IT automation software, part one

Lauren Malhoit bit the bullet and started to learn how to use Puppet automation software. Read her brief, high-level overview of the Puppet Labs Learning VM.

Puppet Enterprise is automation software for IT system admins and consultants. It allows you to automate repetitive tasks such as the installation of applications and services, patch management, and deployments. It seems the sky is the limit, and the available pre-configured modules make it even easier to create these automation programs (or manifests, as they call them) quickly. The Puppet Labs site has a more complete description of what Puppet is and how it works.

For several months I've been telling everyone how much I wanted to get involved with Puppet. This week I finally took the suggestions of several people and checked out the Puppet Learning VM. Puppet Labs has created a great tutorial for beginners, and in this post I'll go in into detail about it.

Puppet Labs Learning VM

Scroll down a bit on the Puppet Learning VM page, click the Get The Learning Puppet VM button, and allow the VM to download. Choose the VMX file if you're using VMware products or the OVA if you're using pretty much anything else. Once the file is downloaded, you can deploy it using your virtualization software. After it boots up, scroll back up on the original web page and start with Part One: Serverless Puppet. I encourage you not to skip any sections in Part One, as it's basically the foundation of how Puppet works.

It starts with Resources and the RAL. There isn't much interactive learning in this section -- it's the very basics. Resources are sort of the building blocks, or as they refer to it, molecules. The RAL is the Resource Abstraction Layer. As it says on the site: "The RAL splits resources into types (high-level models) and providers (platform-specific implementations), and lets you describe resources in a way that can apply to any system."

In the next section about Manifests, you get to test code. (A Puppet program is what Puppet Labs refers to as a manifest.) You need to have some knowledge of Linux to start with this, though it's not difficult. As a quick primer, the following steps should get you started.

1. Create a new file (in this case called 1.file.pp according to the tutorial).

  • a. Log in to your Puppet VM using root.
  • b. Type cd /root to change your directory.
  • c. Type mkdir learning-manifests to create a directory called learning-manifests.
  • d. Type cd learning-manifests to go to that directory.
  • e. Type vi 1.file.pp to create the manifest using the vi editor.

2. Once in the vi editor for 1.file.pp, you can write the example code given. Read this description of how to use the vi editor.

The next sections get a little more into the actual coding: Ordering, Variables, Conditionals, and Facts, and Modules and Classes. Each section includes exercises you can try to see if you're getting the idea as you follow along. These sections get into the "package, file, service" method of creating manifests. The "package" refers to the software package, such as Apache (httpd), that needs to be installed, uninstalled, etc.; the "file" refers to the local files that will be used in the configuration of the package; and the "service" refers to the actual service and whether it is running, stopped, and so on. After you get the hang of creating the code, you can get into creating modules and classes to put several chunks of code together. You can call modules (which I think are much like functions) from other modules and avoid having extraordinarily long pieces of code. In the section Parameterized Classes, you learn more about passing parameters between modules to give even more flexibility and adaptability within your code.

The remaining sections, Templates and Defined Types, go further into how you can re-use code for different modules and create templates for times when you need to only change a couple of lines of code but not the entire module. The tutorial gives the example of assigning different NTP servers to different servers in your environment. These templates look a lot like the config files you would normally use to configure and assign IP addresses, hostnames, etc.

More to come

In my next post about this topic, I will go over Part Two of the tutorial, which introduces you to the Agent/Master configuration of the Puppet VMs. This is the normal configuration, but Part One keeps it easy by only using one VM to get started. I look forward to exploring more Puppet modules and learning how to use them to simplify my repetitive tasks (upgrades, etc.).

How are you using Puppet? What kinds of tasks do you wish were out there? Let us know in the discussion.

About

Lauren Malhoit has been in the IT field for over 10 years and has acquired several data center certifications. She's currently a Technology Evangelist for Cisco focusing on ACI and Nexus 9000. She has been writing for a few years for TechRepublic, Te...

1 comments

Editor's Picks