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
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.
Select the NTP module and click the Update button.
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.
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.
Now, we will assign the NTP class to Foreman host. To do that, go to Hosts >> All Hosts >> Edit (Hosts).
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.
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.
Now, run the puppet agent command on the Foreman host to let NTP service automatically reconfigured by Puppet and the NTP module.
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.
The below screenshot confirms that NTP is being managed by Foreman (Puppet).
Now, it’s time to add hosts to the Foreman.