Ask Your Question
1

How can I make a Puppet module that fixes time?

asked 2013-09-19 16:09:40 -0600

ujjain gravatar image

I have written a Puppet module that corrects the time via NTP, but this only works on server with a small NTP offset. There are sometimes server with a time offset higher than 10 minutes for various reasons.

I want to make a Puppet module that runs exec "service ntpd stop; ntpdate ntp3; service ntpd start" when the ntp offset is too high, to forcably correct the time.

How can I see if the NTP offset is too high in order to tell Puppet to run this command? Or are there better solutions?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-09-19 17:34:17 -0600

GregLarkin gravatar image

updated 2013-09-19 17:35:02 -0600

If you are running on a RHEL/CentOS variant, you can also add a service resource for ntpdate so it runs shortly after boot to correct large offsets. After it runs, the ntpd service starts up and continues correcting small drifts.

If your server drifts a lot while booted for some reason, you could also have an exec resource that runs a script to check for that condition (use ntpdate -q to check time on remote server and compare to system time), then calls the sequence of commands that you listed above.

If your server does not drift appreciably once ... (more)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-09-19 16:09:40 -0600

Seen: 116 times

Last updated: Sep 19 '13