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.

 » Read more..

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’,  » Read more..

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.

 » Read more..

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?

 » Read more..

How Do You Run an Ansible Playbook?

Problem scenario
You want to run an Ansible playbook to push configuration changes down (e.g., transfer files to managed nodes). How do you do this?

Solution
Prerequisites
This assumes that you have set up Ansible. If you need directions for deploying an Ansible control server, see this posting. If you need directions for deploying a managed node after the central Ansible server has been set up,

 » Read more..

How Do You Write an Ansible Playbook to Install a Yum Package?

Problem scenario
How do you use the yum module in an Ansible playbook to install a yum package?

Solution
Prerequisites
This assumes you have installed Ansible and configured a managed node to work with it. If you need assistance with this, see this posting.

Procedures
1.

 » Read more..

How Do You Find The Web UI Credentials for Foreman after You Installed It?

Problem scenario
You want to log into the web UI of Foreman. What do you do?

Solution
1. Run this command: sudo find / -name foreman-installer -type f
2. Based on the results above, run this: sudo /path/to/foreman-installer –foreman-version # Replace “path/to” with the results of the first command (e.g., /usr/sbin/”).
3. The output from the above command should show you the credentials for the administrator user.

 » Read more..

How Do You Know What Version of Foreman Is Installed?

Problem scenario
You inherited a server with Foreman installed. What should you do to find out what version is installed?

Solution
1. Run this command: sudo find / -name foreman-installer -type f
2. Based on the results above, run this:
sudo /path/to/foreman-installer –foreman-version

# Replace “path/to” with the path results of the first command (e.g., /usr/sbin/”).

 » Read more..

How Do You Install Molecule on RHEL v. 8.x with Python 3?

Problem scenario
You are using RHEL version 8.x. You want to use Python 3 and Molecule. What should you do?

Solution
Prerequisites
i. You should install Docker. If you need assistance, see this posting.
ii. You should install these packages before hand:

sudo yum -y install gcc python3-devel
sudo dnf install -y redhat-rpm-config

Procedures
1.

 » Read more..

How Do You Do Variable Expansion with an Ansible Playbook without Introducing Punctuation?

Problem scenario
You use a variable in an Ansible playbook. The value of the variable is surrounded by quotes and brackets. You may refer to it as punctuation [“”]. You want to assign the variable without the new symbols such as ‘[“”]’. How do you get just the value and no punctuation?

Solution
Do not use quotes or square brackets “[]” around the variable.

 » Read more..