How Do You Deploy Puppet Agent to an Ubuntu 16 Linux Server in AWS?

Updated on 4/15/18

Problem scenario
You installed Puppet Master on an AWS instance of Linux.  (See this link if you want to install Puppet Master on Ubuntu.  If you want to install Puppet Master on a Red Hat Enterprise Linux server, see this link). You now want an AWS instance of Ubuntu to be configured as a Puppet Agent node with open source Puppet version 5.

How Do You Install Puppet Master on an AWS Instance of Ubuntu 16?

Updated 12/1/17

Problem scenario
You need to install open source Puppet version 5 on a server to become a Puppet Master.  You have an AWS Ubuntu Linux server.  You only have five minutes to do it.  How do you install Puppet Master immediately?

Solution
1.  Create puppetinstaller.sh in the /tmp directory.  It should have the following lines (stop before you get to step #2):

#!/bin/bash
# Written by continualintegration.com

apt-get update
apt-get -y install ntp
echo ‘
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org
server 3.us.pool.ntp.org’ >>

How Do You Install Puppet Master on a Linux SUSE Server (an AWS Instance)?

Problem scenario
You want to install Puppet Master on SUSE 12.x running in AWS.  You only have five minutes to complete this task.  How do you install Puppet Master immediately?

Solution
1.  Create this file: /etc/zypp/repos.d/puppet.repo

2.  The content of the above file should be the following:

[systemsmanagement_puppet]
name=A network tool for managing many disparate systems (SLE_12)
type=rpm-md
baseurl=http://download.opensuse.org/repositories/systemsmanagement:/puppet/SLE_12/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/systemsmanagement:/puppet/SLE_12/repodata/rep0md.xml.key
enabled=1

3.

A List of Books Related to Puppet (configuration management software)

Here is an alphabetized list of Puppet books. 

Beginning Puppet by Spencer Krum, William Van Hevelingen, Daniele Sluijters
DevOps: Puppet, Docker, and Kubernetes by Packt Publishing
Extending Puppet by Alessandro Franceschi
Instant Puppet 3 Starter by Jo Rhett
Learning MCollective: Parallel Server Management in Puppet and Chef by Jo Rhett
Learning Puppet by Bill Ward
Learning Puppet 2nd Edition by Jussi Heinonen
Learning Puppet 4: A Guide to Configuration Management and Automation by Jo Rhett
Learning Puppet for Windows Server by Fuat Ulugay
Learning Puppet Security by Jason Slagle
Mastering Puppet by Thomas Uphill
Mastering Puppet 5: Optimize enterprise-grade environment performance with Puppet by Packt Publishing
Pro Puppet 2nd Edition by Spencer Krum,

How Do You Troubleshoot Common Problems With Puppet?

Problem scenario:  You want to troubleshoot a variety of issues with Puppet.  You go to Puppet’s page for “Troubleshooting Common Errors.” It says that a “A newer version is available; see the version menu above for details.” ​

But every link newer than Version 2.8 you try gives you this “We tried to find that page, but 404.”

Solution
Google the error itself.  

How Do You Get the Puppet Master Service to Run for The First Time?

Problem scenario
Your newly installed Puppet Master is not working.  The main service will not start.  You try this command:  service puppetserver restart

You see this as the results of the above command:
“Job for puppetserver.service failed because the control process exited with error code. See “systemctl status puppetserver.service” and “journalctl -xe” for details.”

You then try this command to see what is wrong (per the error message above):
systemctl status puppetserver.service

It results in this:

? …

How Do You Solve The Problem When Puppet Agent Returns an Error About “require_relative for main:Object”?

Problem scenario:  On a Linux server you run “puppet agent -t” to apply a manifest on a Puppet Agent.  You receive this error:

“Error: Could not retrieve local facts: undefined method ‘require_relative’ for main:Object”

What do you do to fix this?

Solution:  Install a compatible version of Puppet agent on the server.  One way to do this is to run this command:

curl -k https://continualintegration:8140/packages/current/install.bash | sudo bash`

#where “continualintegration” is the hostname (or FQDN) of the Puppet Master server.

How Can Puppet’s Logging Stay With a Manifest That Has a Long Duration On A Windows Server?

Problem scenario:  Some manifests kick off a non-Puppet script that has a long duration.  By default the manifest will time out after 300 seconds.  That means the manifest will not run properly if it cannot complete in five minutes.  How do you run long-duration manifests?

Solution (Part 1 of 2):  Use the timeout => directive.  For example in the Puppet manifest, have a stanza like this:

Puppet Needs To Use a Windows Network File Share: How Is This Done Consistently?

Problem Scenario:  You are using Puppet Master on Linux and Puppet Agent on Windows servers.  The manifest attempts to copy to or from a Windows network file share, but you are getting an error about the network path not existing.  The network file share has permissions that are open to Everyone.  What do you do?

Solution:  Puppet Agent will run PowerShell commands under the security context of the user who runs the “puppet agent -t -d” command. 

How Do You Control The Order Of When Puppet Manifests Are Applied to a Puppet Agent?

Problem scenario:  One Puppet manifest relies on another manifest to work.  Trying to apply them at the same time is not working.  The “require” and “before” keywords only seem to work for packages, exec, and file resources.  What do you do to order the manifests to satisfy dependency requirements of other manifests?

Solution:  The relationship dependency can be solved by the order in which they are applied.