Learn how to use Puppet IT automation software, part two

Lauren Malhoit goes over Part Two of the Puppet Labs Learning VM tutorial, which introduces you to the Agent/Master configuration of the Puppet VMs.

Puppet Enterprise is automation software for IT system admins and consultants. A couple weeks ago I wrote a blog using Part One of the Puppet Labs Learning VM tutorial. In the first part of the tutorial, we used only one Puppet VM. This was basically for learning purposes, as Puppet generally works in a master/agent configuration with two VMs. In this post, I'll concentrate on Part Two of the Puppet Labs Learning VM tutorial, which will require the use of the master/agent configuration. We're using the tutorials featured in my previous Puppet Labs post.

Our first step is to make sure we have an up to date Puppet VM. You can check the version by logging in to your puppet VM as root and typing puppet - - Version. They're suggesting you have a version above 2.0. If you don't have one of the latest versions, follow the instructions to upgrade. I'll skip ahead, since mine is pretty up to date as shown in Figure A. Figure A

Learning Puppet VM

After we make sure we're up to date, we can clone the VM to create a new one. The tutorial walks you through doing it in VMware Fusion or VirtualBox. Follow these steps to do so in VMware Workstation.

1. While still logged in to your Puppet VM, shut it down by typing shutdown -h now.

2. Right-click your Learning Puppet VM and select Manage | Clone.

3. You can select to Clone From The Current State In The Virtual Machine.

4. Select Create A Full Clone in the Clone Type window of the clone wizard.

5. Give it a name and then click through the rest of the wizard. This will act as your agent, which can have a minimum of 256 MB of RAM (the master should have at least 512 MB). I've left mine at 1 GB, just because I can.

6. Start your puppet master vm.

7. Start your puppet agent vm and specify that you copied it if it asks you.

8. Install the learningpuppet module on the agent VM by following these steps:

  • a. Log in to the agent VM using root.
  • b. To download the module, type wget
  • c. To unzip the file, type tar -xzf learningpuppet.tar.gz.
  • d. To move the file into the proper directory, type mv learningpuppet /etc/puppetlabs/puppet/modules/.
  • e. To apply the makeagent class, type puppet apply -e "class {‘learningpuppet::makeagent':}".

9. Make sure the master and agent VMs can communicate by IP and name by following these steps:

  • a. Make sure the firewalls are off by typing service iptables status, and it should say stopped.
  • b. On both VMs, type ifconfig eth0 to get the IP address of the eth0 adapters.
  • c. Ping the master's IP from the agent and vice versa.
  • d. If you receive replies back on both cases, you're all set. If not, do the usual things to ensure network connectivity (i.e., check firewalls, make sure you have everything set to NAT in the case of VMware Workstation, etc.).
  • e. To edit the host files so you can check if each VM is pingable by name, type nano /etc/hosts and put in the IP of the other VM along with the name (ex on master: agent1.localdomain puppet).
  • f. Ping agent1 from the master VM and puppet from the agent VM.
  • g. Make sure the times are relatively close by typing date -u on each VM and comparing them.

This should complete the installation of the second VM and ensure that all communication between the master and agent VMs is fully functional.

Now we'll move on to understanding why we use both VMs. The puppet master generally contains the manifests and handles the compilation, whereas the puppet agent contains the request catalog and applies the compiled manifests/classes. See the diagrams below. Figure B is puppet-singlenode. Figure C is puppet-agentmaster. Figure B

Image courtesy of Puppet Labs.
Figure C

Image courtesy of Puppet Labs.

According to the tutorial, the agents will pull data from the master periodically, but you can also do it manually instead. For the purposes of the tutorial, they'd like you to stick with manually pulling from the master. Here are the commands you need to know for pulling data:

1. To check the status, type /etc/init.d/pe-puppet status.

2. If it is running and you'd like to turn it off, type /etc/init.d/pe-puppet stop.

3. To run it in manual mode, type puppet agent -test, and this will also give you a report of what happens (Figure D). Figure D

Stay tuned

In a future post, I will go over using both the master and agent VMs to start running automation.

Has anyone else been through these tutorials, or are you using the free or enterprise version of puppet in your environment yet? If so, I'd love to hear your thoughts or get ideas on what you're using it for.


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...


Editor's Picks