Skip to content
Snippets Groups Projects
Name Last commit Last update
defaults
handlers
meta
tasks
templates
vars
README.md

NTP

Installs and configures the NTP service.

Requirements

This role requires Ansible 2.0 or higher.

Role Variables

If you're only trying to set up a host as a NTP client, then you can stick with the defaults. You may want to update the ntp_pools variable to point to a closer pool, but you don't have to. Most of the other variables are onl;y relevant if you're setting up a NTP server.

Variable Default Purpose
ntp_enabled true Asserts whether the NTP sevice should be enabled and start at boot.
ntp_server false Asserts whether the host should be configured to respond to time requests.
ntp_logging false Asserts whether logging should be enabled.
ntp_sync_now false Asserts whether the NTP service should immediately sync with its configured time servers, without regard to "easing", or errors poteentially caused by "jumps" in time.
ntp_restrict ['127.0.0.1', '::1'] Additional access restrictions. We already define secure defaults based on the value of ntp_server. Any additional ntp_restrict entries are likely to allow more access.
ntp_servers [] A list of NTP servers to query for time. It's recommended to use ntp_pools, but we support declaring specific servers too for backwards compatibility.
ntp_pools [pool.ntp.org] A list of NTP pool addresses. Using 1 pool is fine, and will result in multiple actual servers being used.
ntp_peers [] A list of NTP servers to peer with. You will have to add the appropriate ntp_restrict entries to allow peering.

Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

- hosts: servers
  roles:
    - { role: ntp, ntp_pools: [us.pool.ntp.org] }