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](https://www.itzgeek.com/wp-content/uploads/2018/10/Install-Foreman-on-Ubuntu-18.04-Import-Environments-1024x457.jpg)
Select the NTP module and click the Update button.
![Install Foreman on Ubuntu 18.04 - Select Environments](https://www.itzgeek.com/wp-content/uploads/2018/10/Install-Foreman-on-Ubuntu-18.04-Select-Environments-1024x406.jpg)
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](https://www.itzgeek.com/wp-content/uploads/2018/10/Install-Foreman-on-Ubuntu-18.04-Puppet-Classes-1024x440.jpg)
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](https://www.itzgeek.com/wp-content/uploads/2018/10/Install-Foreman-on-Ubuntu-18.04-Edit-Puppet-Module-Parameters-1024x695.jpg)
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](https://www.itzgeek.com/wp-content/uploads/2018/10/Install-Foreman-on-Ubuntu-18.04-Edit-Host-1024x432.jpg)
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](https://www.itzgeek.com/wp-content/uploads/2018/11/Install-Foreman-on-Ubuntu-18.04-Add-Puppet-Classes-to-Host-1024x696.jpg)
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](https://www.itzgeek.com/wp-content/uploads/2018/11/Install-Foreman-on-Ubuntu-18.04-YAML-1024x648.jpg)
Output:
![Install Foreman on Ubuntu 18.04 - YAML Output](https://www.itzgeek.com/wp-content/uploads/2018/11/Install-Foreman-on-Ubuntu-18.04-YAML-Output-1-1024x646.jpg)
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.
![Install Foreman on Ubuntu 18.04 - Report of Host](https://www.itzgeek.com/wp-content/uploads/2018/11/Install-Foreman-on-Ubuntu-18.04-Report-of-Host-1024x649.jpg)
The below screenshot confirms that NTP is being managed by Foreman (Puppet).
![Install Foreman on Ubuntu 18.04 - NTP Configuration File Managed by Foreman](https://www.itzgeek.com/wp-content/uploads/2018/11/Install-Foreman-on-CentOS-7-NTP-Configuration-File-Managed-by-Foreman-1024x332.jpg)
Now, it’s time to add hosts to the Foreman.
READ: How To Add Puppet Nodes to Foreman
That’s All.