Managing a NTP service using Puppet

0 votes

I have installed a puppet server and a unix agent and logged in as a root user. I am using NTP to sync all the clocks across all my servers in a network and for this i have installed the puppetlabs-ntp module using the command 

puppet module install puppetlabs-ntp

After executing this command, the output is something like this:

Preparing to install into /etc/puppetlabs/puppet/modules ... 
Notice: Downloading from http://forgeapi.puppetlabs.com ... 
Notice: Installing -- do not interrupt ... 
/etc/puppetlabs/puppet/environments/production/modules 
└── puppetlabs-ntp (v3.1.2)

How should i go further? What more should i need to do inorder to configure so that puppet  manages NTP?

Jul 25, 2019 in Puppet by Namik
• 1,230 points
2,101 views

1 answer to this question.

0 votes

You’ve just  finished installing the puppetlabs-ntp module.

  • The next step is adding classes from the NTP module to the main manifest.

  • The NTP module contains several classes. Classes are named chunks of Puppet code and are the primary means by which Puppet configures nodes. The NTP module contains the following classes:

  1. ntp: the main class, which includes all other NTP classes, including the classes in this list.

  2. ntp::install: handles the installation packages.

  3. ntp::config: handles the configuration file.

  4. ntp::service: handles the service.

  • You’re going to add the ntp class to the default node in your main manifest. Depending on your needs or infrastructure, you might have a different group that you’ll assign NTP to, but you would take similar steps.

  • From the command line on the master, navigate to the directory that contains the main manifest:

cd /etc/puppetlabs/code/environments/production/manifests
  • Use your text editor to open site.pp.

  • Add the following Puppet code to site.pp:

node default { 
class { 'ntp': 
servers => ['nist-time-server.eoni.com','nist1-lv.ustiming.org','ntp-nist.ldsbc.edu'] 
} 
}
  • On your agent, start a Puppet run:

puppet agent -t
  • Your Puppet-managed node is now configured to use NTP. 

  • To check if the NTP service is running, run:

puppet resource service ntpd
  • The result looks like this:

service { 'ntpd': 
ensure => 'running', 
enable => 'true',
}
  • If you want to configure the NTP service to run differently on different nodes, you can set up NTP on nodes other than default in the site.pp file.

  • In previous steps, you’ve been configuring the default node.

  • In the example below, two NTP servers (kermit and grover) are configured to talk to outside time servers. The other NTP servers (snuffie, bigbird, and hooper) use those two primary servers to sync their time.

  • One of the primary ntp servers, kermit, is very cautiously configured — it can’t afford outages, so it’s not allowed to automatically update its NTP server package without testing. The other servers are more permissively configured.

  • The site.pp looks like this:

node "kermit.example.com" { 
class { "ntp": 
servers => [ '0.us.pool.ntp.org iburst','1.us.pool.ntp.org iburst','2.us.pool.ntp.org iburst','3.us.pool.ntp.org iburst'], 
autoupdate => false, 
restrict => [],
enable => true, 
} 
} 
node "grover.example.com" { 
class { "ntp": 
servers => [ 'kermit.example.com','0.us.pool.ntp.org iburst','1.us.pool.ntp.org iburst','2.us.pool.ntp.org iburst'], 
autoupdate => true, 
restrict => [], 
enable => true, 
} 
} 
node "snuffie.example.com", "bigbird.example.com", "hooper.example.com" { 
class { "ntp": 
servers => [ 'grover.example.com', 'kermit.example.com'], 
autoupdate => true, 
enable => true, 
} 
}

In this way, it is possible to configure NTP on multiple nodes to suit your needs.

answered Jul 25, 2019 by Sirajul
• 59,230 points

Related Questions In Puppet

0 votes
1 answer

What are the advantages of using Puppet as a CM tool?

Here's a list of a few advantages ...READ MORE

answered Jul 30, 2019 in Puppet by Sirajul
• 59,230 points
1,182 views
0 votes
1 answer

Puppet: Deploy configuration changes using a orchestrator

You can use the orchestrator to enforce ...READ MORE

answered Aug 1, 2019 in Puppet by Sirajul
• 59,230 points
512 views
0 votes
1 answer

Puppet : Can i install jenkins on a puppet server using Git?

Installing puppet-jenkins is easy. To install via Git, ...READ MORE

answered Aug 9, 2019 in Puppet by Sirajul
• 59,230 points
527 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,460 views
+2 votes
1 answer
0 votes
1 answer

Puppet+Docker:Creating a Docker service using a Puppet manifest

Docker services are used to create distributed ...READ MORE

answered Aug 14, 2019 in Puppet by Sirajul
• 59,230 points
591 views
0 votes
1 answer

Managing a Domain Name System (DNS) nameserver file with Puppet.

In this case, you could  build a private ...READ MORE

answered Jul 26, 2019 in Puppet by Sirajul
• 59,230 points
645 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP