ANXS - ntp
Ansible role for installing and configuring NTP time synchronization. Manages the NTP daemon, server/pool configuration, access restrictions, leap seconds file, and optional periodic ntpdate sync via cron or systemd timer. Supports both classic ntp and ntpsec (Debian 13+).
- Ansible 2.12 or higher.
- Ubuntu 20.04+ or Debian 11+.
A partial listing of high-impact variables. See defaults/main.yml for the full set.
ntp_servers(defaults to0-3.pool.ntp.org) controls the list of NTP servers to sync against.ntp_auto_update(defaults tofalse) enable periodic ntpdate sync as a forcing function.ntp_use_systemd_timer(defaults tofalseunless on Ubuntu noble) use a systemd timer instead of cron.ntp_auto_update_hour(defaults to12) to change the hour interval for periodic sync.
ntp_timezone(defaults toUTC) for the system timezone.
Tests use Molecule with Docker and Testinfra. Run the full suite with make test, or target a specific platform (e.g. make test-ubuntu2404).
The test suite verifies package installation (ntp/ntpsec), config file permissions, server and restriction directives, driftfile presence, leap seconds file fetch, and NTP service status. Tests run across all supported Linux distributions.
This project has been developed with AI assistance. Contributions making use of AI generated content are welcome, however they must be human reviewed prior to submission as pull requests, or issues. All contributors must be able to fully explain and defend any AI generated code, documentation, issues, or tests they submit. Contributions making use of AI must have this explicitly declared in the pull request or issue. This also applies to utilization of AI for reviewing of pull requests.
Are always welcome!