How To Install Foreman on CentOS 7 / RHEL 7 / Oracle Linux 7

1

Download and Install NTP module

For a demo, we will install a Puppet NTP module for managing the NTP service throiugh Foreman.

If you have Puppet 2.7.14 or higher, install the module automatically from Puppet Forge to our “production” environment (the default).

Use the following command to install NTP module on Foreman (Puppetmaster) host.

/opt/puppetlabs/bin/puppet module install puppetlabs/ntp

Output:

Notice: Preparing to install into /etc/puppetlabs/code/environments/production/modules ...
Notice: Downloading from https://forgeapi.puppet.com ...
Notice: Installing -- do not interrupt ...
/etc/puppetlabs/code/environments/production/modules
└─┬ puppetlabs-ntp (v7.3.0)
  └── puppetlabs-stdlib (v5.1.0)

In Foreman’s web console, go to Configure >> Puppet >> Classes and click Import from hostname (server.itzgeek.local) to read the available Puppet classes from the puppet master and populate Foreman’s database.

Install Foreman on CentOS 7 - Import Environments
Install Foreman on CentOS 7 – Import Environments

Select the NTP module and click the update button.

Install Foreman on CentOS 7 - Apply Changes
Install Foreman on CentOS 7 – Apply Changes

After clicking the update button, you will see something like below. The ntp class will appear in the Puppet class list if installed correctly. Click on NTP class on the left.

Install Foreman on CentOS 7 - Puppet Classes
Install Foreman on CentOS 7 – Puppet Classes

Now, Click the Smart Class Parameter and then select Servers on the left side. Tick the Override checkbox so that Foreman manages the servers parameter. Type the server names in Default Value and then click Submit.

Install Foreman on CentOS 7 - Change NTP Module Parameters
Install Foreman on CentOS 7 – Change NTP Module Parameters

Now, we will assign the NTP class to Foreman host. To do that, go to Hosts >> All Hosts >> Edit (Hosts).

Install Foreman on CentOS 7 - Edit Host
Install Foreman on CentOS 7 – Edit Host

Go to Puppet Classes tab and expand the ntp module and click the + icon to add the ntp class to the host, and then click submit.

Install Foreman on CentOS 7 - Include NTP Class
Install Foreman on CentOS 7 – Include NTP Class

This time, it will take you automatically to the host details page. Click on YAML, and it will show the ntp class and the server list parameter, as passed to Puppet via the ENC (external node classifier) interface.

Install Foreman on CentOS 7 - Host Details
Install Foreman on CentOS 7 – Host Details

Output:

Install Foreman on CentOS 7 - YAML Output
Install Foreman on CentOS 7 – YAML Output

At last, run the following command on the Foreman host to see the NTP service automatically reconfigured by Puppet and the NTP module.

/opt/puppetlabs/bin/puppet agent --test

Verify the installation of NTP module by going to Hosts >> All Hosts >> Select Foreman Host >> Reports >> Latest report.

Install Foreman on CentOS 7 - Host Report
Install Foreman on CentOS 7 – Host Report

The below screenshot confirms that NTP is being managed by Foreman (Puppet).

Install Foreman on CentOS 7 - NTP Configuration File Managed by Foreman
Install Foreman on CentOS 7 – NTP Configuration File Managed by Foreman

The Foreman is now ready and it’s time to add new hosts to it.

READ: How To Add Puppet Nodes to Foreman

That’s All.

You might also like