How Do You Run a Bolt Command from a Linux Server to a Windows Server?

Problem scenario
You want to run a PowerShell script or run an interactive command on a Windows server. You have Puppet Bolt installed on a Linux server. You do not need to use SSL. What do you do?

Solution
Run a command like this (but substitute x.x.x.x with the IP address of the Windows server, jdoe with the username and coolpassword with jdoe’s password):

bolt command run “Get-Process” –Targets winrm://x.x.x.x –no-ssl –user jdoe –password coolpassword

To run a script called “cool.ps1”,

How Do You Install Puppet Master Version 6 on a RHEL Version 8.x Server?

Problem scenario
You want to install Puppet Master version 6.x on a RHEL version 8.x server. What do you do?

Solution
Run this script:

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

yum -y update
rpm -ivh https://yum.puppetlabs.com/puppet6/puppet6-release-el-8.noarch.rpm
# rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-el-8.noarch.rpm
# To install a legacy version of Puppet (3.x), comment out the first rpm stanza and uncomment out the second.

yum -y install puppetserver
ln -s /opt/puppetlabs/puppet/bin/puppet /usr/bin/puppet …

How Do You Troubleshoot a Puppet Manifest when The Errors and Logging Do Not Help You? (abridged version)

ABRIDGED VERSION (To see the unabridged version, see this posting.)

Problem scenario
A Puppet manifest is not working, but there are no obvious error messages. When running the puppet agent command, you use the -d flag for debugging. In your manifest, you use logoutput => true stanza. But still, you cannot figure out why your manifest is not working.

You tried this command: puppet parser validate nameOfManifest.pp

The above command had no output.

How Do You Troubleshoot the Puppet Error “file mode specification must be a string, not ‘Integer'”?

Problem scenario
You are running a manifest and you get this error:

Error: Failed to apply catalog: Parameter mode failed on File[/opt/hadoop/hadoop-2.2.0.tar.gz]: The file mode specification must be a string, not ‘Integer’ at /etc/puppetlabs/code/environments/production/modules/hadoop/manifests/init.pp:55

What is wrong?

Solution
Go to the Puppet Master server and open the file in the error. (The error provides the full directory path.) Go to the line number that the error message specifies.

How Do You Create a Puppet Manifest to Install Java?

Problem scenario
You have Puppet agent and Puppet Master set up and configured to work together. You are are running open source Puppet 5.x on Ubuntu servers in AWS. You want to install Java on the Puppet agent nodes. You tried to use the Java module.

On the Puppet Master server, you ran this: puppet module install puppetlabs-java –version 2.2.0

This is your site.pp file:

class { ‘java’ :
package =’java-1.8.0-openjdk-devel’, …

How Do You Troubleshoot Puppet Agent with a “Failed to open TCP connection…connection refused port 8140” error?

Problem scenario
You run puppet agent but you get this error:

Error: Could not request certificate: Failed to open TCP connection to puppetmaster.domain.com:8140 (Connection refused – connect(2) for “puppetmaster.domain.com” port 8140)

What do you do?

Solution
Ensure port 8140 is open. Install nmap on a server, and run this command:

nmap -p 8140 puppetmaster.domain.com

If you see this

PORT STATE SERVICE
8140/tcp closed unknown

Then the Puppet Master service is not running.

How Do You Troubleshoot the Puppet Problem “Error 500 on SERVER: … Could not find node statement with name ‘default’ or “?

Problem scenario
You run the Puppet agent on a server but you receive this error:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not find node statement with name ‘default’ or ‘ip-172-31-20-105.us-east-2.compute.internal, ip-172-31-20-105.us-east-2.compute, ip-172-31-20-105.us-east-2, ip-172-31-20-105’ on node ip-172-31-20-105.us-east-2.compute.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

What should you do?

How Do You Troubleshoot no_manifest Being Returned by a “puppet master –configprint manifest” Command?

Problem scenario

From the Puppet master server you run this command: puppet master –configprint manifest

But it returns “no_manifest”

Manifests are working. Puppet agent nodes are receiving the changes of manifests on the Puppet master server.

This command seems to work perfectly (except for the manifest line): puppet master –configprint all

What is wrong?

Solution

Possible solution #1
The root cause could be a permissions issue.

How Do You Install Katello (and Foreman) on a Linux Server?

Problem scenario
You have heard of a Foreman plugin called Katello that supports Red Hat subscription and repository management. Katello supports other plugins such as Pulp (for downloading content) and Candlepin (for managing the meta aspects of the subscriptions themselves). How do you install Katello?

Solution
Warning 1: This works for CentOS. It may work for Fedora.