Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status


ntp_cluster (13) Versions 1.0.6

Configures an HA and highly consistent NTP Cluster synced to wall clock time

cookbook 'ntp_cluster', '= 1.0.6', :supermarket
cookbook 'ntp_cluster', '= 1.0.6'
knife supermarket install ntp_cluster
knife supermarket download ntp_cluster
Quality 0%


Build Status

Provides automated discovery and configuration of a private ntp pool via chef.


This cookbook will automagically assign master and standby nodes in the cluster.
The only thing you have to have is a role named ntp_server and assign that role
to the node that you want to be part of the ntp cluster

This role should be the same role used in the ['ntp_cluster']['discovery'] search string.

You should NOT use any of the extra recipes in this cookbook, just use the default
recipe and the ntp_server role as it will take care of all the chef magic.


The concept behind this type of NTP Cluster is to have a cluster that is consistent enough to
run time sensitive distributed applications like Cassandra where nodes in the application cluster
needs to be completely in sync with each other (read microseconds) and reasonably close to wall clock time.
To accomplish this a single true time server (master) is synced with the outside world. All application servers
sync with this server (or its standbys in the event of failure). This ensures that all the
application servers are obtaining their time from the exact same external source and are connected to a very
low-latency low-demand internal server.

Standby servers are used for when a failure in the master occurs. If the master fails, clients will
sync with the standby servers which will maintain their understanding of time with each other using
peered timekeeping.

If the master node is completely removed from the cluster (delete node from chef-server) then a standby server is
promoted to master and given the external server list to sync with, all remaining standby servers will pull their
times directly from the newly promoted standby.

It is highly recommended that you set the ['ntp_cluster']['public_servers'] to a pool better than the
ntp cookbook's default pool.

Commissioning a new cluster

To commission a new cluster you must be patient. This is time, it moves slowly. Understand that first. Second, NTP is a very redundant
and methodical protocol. The worst thing you can do is rush this process because there are a lot of slow moving parts (NTP, DNS, Chef).

  1. Provision a box with the ntp_cluster recipe. This box will immediately become a master and start syncing its time
  2. Wait an hour and then verify that the master's clock is correct. Waiting allows both NTP to sync its time, DNS to propagate, and chef to runs some extra convergences
  3. Provision all your standby servers. This can happen in bulk.
  4. Wait another hour for the standby layer to sync up.
  5. Verify that the cluster is configured properly by checking the server and peer directives in /etc/ntp.conf
  6. Enable ntp_server for all of your application servers. They will immediately start looking to the new cluster for time. If the time it vastly off by 100ms or more then they WILL jump. Be aware of the dangers of time jumps.


If there are problems commissioning a server check /etc/ntp.conf and use the ntpq -p command to show the connected servers and there statuses


Lastly, NTP communicates on UDP port 123. Make sure that all of your server nodes are accepting UDP packets on port 123

Commissioning Servers

Master Server

Master servers should not be commissioned directly. They should be promoted from existing slaves as the clock is already in sync

Standby Server

  1. Create the server and apply the ntp_cluster cookbook to it.
  2. Converge the server.
  3. Verify that /etc/ntp.conf is configured to peer with the standbys and have the master as its only server

Decommissioning Servers

Master Server

  1. Delete the node and client from the chef-server.
  2. Converge 1 of your standby servers so that it will promote itself to master
  3. Verify that the new master has been selected by performing knife search 'tags:ntp_master'
  4. Converge the rest of your standbys
  5. Converge all of your servers so that they stop looking to the old master
  6. Burn down the old master

Standby Server

  1. Delete the node and client from the chef-server.
  2. Converge all of your other standbys so that they stop looking to that standby server
  3. Converge all of your application servers so that they stop looking to that standby server
  4. Burn down the box


  1. Just burn it down

Replacing Servers

Master Server

You should follow the decommissioning of a master server process above and then provision a new standby

Standby Server

Follow the decommissioning of a standby server then commission a new standby

Supported Platforms

  • Ubuntu 12.04
  • Ubuntu 14.04


<td>The Chef Search query to find ntp servers</td>
<td>The List of external servers to sync with</td>
<td><tt> servers</tt></td>



Include this recipe in a wrapper cookbook:

depends 'ntp_cluster', '~> 1.0'

And then in your wrapper cookbook

include_recipe 'ntp_cluster::default'

License and Authors

Author:: EverTrue, Inc. (

Dependent cookbooks

ntp ~> 1.7
apt >= 0.0.0
cron ~> 1.6

Contingent cookbooks

There are no cookbooks that are contingent upon this one.


  • Wrap cron monitor commands in quotes.


  • Pipe stdout from the monitor script to logger to prevent root cron emails


  • Documentation Updates


  • Always run the monitor recipe so that cron job gets removed if monitor is disabled
  • Removed redundant iburst
  • Set ntp server pool to the default


  • set ['ntp']['servers'] and ['ntp']['peers'] in ntp_cluster::master recipe
  • Stores the public ntp servers in a different attribute to avoid overrides
  • set the ['ntp']['servers'] attribute instead of default


  • Update Attribute precidence for ntp master, slave, and ntp cookbook settings


Initial release of ntp_cluster


  • Master/Slave cluster configuration
  • Chef elected master/slaves
  • Monitoring scripts
  • Overrides to the amazon ntp pool
  • Lots of other NTP goodies

Foodcritic Metric

1.0.6 failed this metric

FC002: Avoid string interpolation where not required: /tmp/cook/7c0af62e4036fccde18c13ba/ntp_cluster/recipes/discover.rb:50
FC003: Check whether you are running with chef server before using server-specific features: /tmp/cook/7c0af62e4036fccde18c13ba/ntp_cluster/recipes/discover.rb:20