How To Install Foreman on Ubuntu 18.04 / Ubuntu 16.04 & Debian 9

0

Download and Install NTP module

We will now install the Puppet NTP module for managing the NTP service from Foreman.

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

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

sudo /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.2.0)
  └── puppetlabs-stdlib (v4.25.1)

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

Install Foreman on Ubuntu 18.04 - Import Environments
Install Foreman on Ubuntu 18.04 – Import Environments

Select the NTP module and click the Update button.

Install Foreman on Ubuntu 18.04 - Select Environments
Install Foreman on Ubuntu 18.04 – Select Environments

After clicking the update button, the ntp class will appear in the Puppet class list if installed correctly. Click on ntp class on the left.

Install Foreman on Ubuntu 18.04 - Puppet Classes
Install Foreman on Ubuntu 18.04 – Puppet Classes

Now, click the Smart Class Parameter >> Servers (on the left side). Tick the Override checkbox to let Foreman manages the servers parameter of the class.

Change the default value if you want to use your own NTP servers. Ensure you select Array as Key Type.

Finally, click Submit.

Install Foreman on Ubuntu 18.04 - Edit Puppet Module Parameters
Install Foreman on Ubuntu 18.04 – Edit Puppet 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 Ubuntu 18.04 - Edit Host
Install Foreman on Ubuntu 18.04 – Edit Host

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

Install Foreman on Ubuntu 18.04 - Add Puppet Classes to Host
Install Foreman on Ubuntu 18.04 – Add Puppet Classes to Host

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

Install Foreman on Ubuntu 18.04 - YAML
Install Foreman on Ubuntu 18.04 – YAML

Output:

Install Foreman on Ubuntu 18.04 - YAML Output
Install Foreman on Ubuntu 18.04 – YAML Output

Now, run the puppet agent command on the Foreman host to let NTP service automatically reconfigured by Puppet and the NTP module.

ADVERTISEMENT

sudo /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 Ubuntu 18.04 - Report of Host
Install Foreman on Ubuntu 18.04 – Report of Host

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

Install Foreman on Ubuntu 18.04 - NTP Configuration File Managed by Foreman
Install Foreman on Ubuntu 18.04 – NTP Configuration File Managed by Foreman

Now, it’s time to add hosts to the Foreman.

READ: How To Add Puppet Nodes to Foreman

That’s All.

You might also like