opsta.ntp
Ansible Role: NTP
This role installs NTP (Network Time Protocol) on Linux.
Requirements
No special requirements.
Role Variables
Here are the variables you can use, along with their default values (check defaults/main.yml
):
ntp_enabled
: true
This decides if the ntpd service should start and be enabled to run when the system boots. It's usually better not to run the NTP daemon on many virtual machines inside containers (like OpenVZ or VirtualBox) because the host machine should handle time synchronization for its child VMs.ntp_timezone
: Etc/UTC
This sets the timezone for your server.ntp_manage_config
: false
Set this to true if you want this role to manage the NTP configuration file at/etc/ntp.conf
.ntp_area
: ''
Specify the NTP Pool Area you want to use. The default is none, which means it will use the global pool.ntp_servers
:- "0{{ ntp_area }}.pool.ntp.org iburst" - "1{{ ntp_area }}.pool.ntp.org iburst" - "2{{ ntp_area }}.pool.ntp.org iburst" - "3{{ ntp_area }}.pool.ntp.org iburst"
List the NTP servers you'd like to connect to. This only works if you allow the role to manage NTP configurations by setting
ntp_manage_config
totrue
.ntp_restrict
:- "127.0.0.1" - "::1"
This restricts NTP access to these hosts, which is loopback by default.
ntp_enable_local_clock
: false
Set this to true if you want to use the local clock when you're not connected to the internet.
Dependencies
No dependencies.
Example Playbook
- hosts: all
roles:
- geerlingguy.ntp
In vars/main.yml
:
ntp_timezone: America/Chicago
License
MIT / BSD
Author Information
This role was created in 2014 by Jeff Geerling, the author of Ansible for DevOps.