Managing network time with Ansible using chrony.
MIT / BSD
- Made and maintained by: Kasra Amirsarvari
- Ansible Galaxy community author: https://galaxy.ansible.com/caseraw
- Dockerhub community user: https://hub.docker.com/u/caseraw
- Ensure a package manager is available and configured with the correct package sources and repositories.
- Ensure privileged permissions are set for the user executing this role to:
- Install and uninstall.
- Edit files provided by the package itself.
- Manage
systemd
services forntpd
andchronyd
.
- Ensure network traffic over 123/udp (port/protocol) is allowed.
- Outbound for any servers providing NTP.
- Inbound for any clients retrieving NTP.
N/A
Compatible with the following list of operating systems:
- CentOS 7
- CentOS 8
- RHEL 7.x
- RHEL 8.x
Variable name | Description |
---|---|
role_chrony_chrony_dot_conf_parameters | A dictionary containing the chrony configuration. |
role_chrony_required_packages | A list of packages that need to be installed for chrony to work properly. |
role_chrony_time_zone | The timezone to set. |
---
- name: Manage the installation and configuration of chrony for NTP
become: True
gather_facts: False
roles:
- role: ansible_role_chrony
...
chronyc tracking
chronyc sources
chronyc sourcestats
The following links provide more information about chrony and it's usage.
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ntp_using_the_chrony_suite
- https://chrony.tuxfamily.org/faq.html
This role is locally tested with the use of Molecule, the configuration is located at: molecule/default.
The Molecule tests are run (using the docker driver) on Dockerhub images built for this purpose:
Some specific configurations might require a full OS instead of a minimal container image. In these use-cases make use of molecule driver for vagrant with the libvirt provider. The Molecule driver and platform configuration part could look something like this:
driver:
name: vagrant
provider:
name: libvirt
platforms:
- name: ansible_role_chrony-ansible-molecule-centos-7
box: centos/7
imemory: 1024
cpus: 1
This role uses Travis CI to run online tests with the use of Molecule and pushes notifications to import the role into Ansible Galaxy once the tests are successful. The Travis CI configuration is located at the root of the Ansible role .travis.yml
- GitHub repository: https://github.com/Caseraw/ansible_role_chrony
- Travis CI build status: https://travis-ci.org/Caseraw/ansible_role_chrony
- Ansible Galaxy role: https://galaxy.ansible.com/caseraw/ansible_role_chrony