adamus1red.ansible_role_ntp
Ansible Role: NTP
This role installs NTP (Network Time Protocol) on Linux systems.
Requirements
No special requirements are needed.
Role Variables
Below are the available variables and their default values (see defaults/main.yml
):
ntp_enabled: true
This determines whether the ntpd service should start and be enabled when the system boots. It's best not to run the NTP daemon on many virtual machines within containers (like OpenVZ or VirtualBox) since the host should be responsible for keeping time synced for its virtual machines.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 (/etc/ntp.conf
).ntp_area: ''
This specifies the NTP Pool Area you want to use. It defaults to none, which means it will use the global pool.ntp_servers:
- "0{{ '.' + ntp_area if ntp_area else '' }}.pool.ntp.org iburst"
- "1{{ '.' + ntp_area if ntp_area else '' }}.pool.ntp.org iburst"
- "2{{ '.' + ntp_area if ntp_area else '' }}.pool.ntp.org iburst"
- "3{{ '.' + ntp_area if ntp_area else '' }}.pool.ntp.org iburst"
Here, you can specify which NTP servers to use. This only works if you setntp_manage_config
toTrue
.
ntp_restrict:
- "127.0.0.1"
- "::1"
This restricts NTP access to these hosts, and by default, it only allows loopback.
Dependencies
There are no dependencies.
Example Playbook
Here’s an example playbook:
- hosts: all
roles:
- geerlingguy.ntp
In vars/main.yml
:
ntp_timezone: America/Chicago
License
This role is licensed under MIT / BSD.
Author Information
This role was created in 2014 by Jeff Geerling, who is also the author of Ansible for DevOps.
NTP installation and configuration for Linux.
ansible-galaxy install adamus1red.ansible_role_ntp