Skip to content

Ansible role that takes care of the installation and configuration of chrony for NTP

Notifications You must be signed in to change notification settings

Caseraw/ansible_role_chrony

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible role chrony

Managing network time with Ansible using chrony.

Build Status

License

MIT / BSD

Author Information

Requirements

  • 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 for ntpd and chronyd.
  • Ensure network traffic over 123/udp (port/protocol) is allowed.
    • Outbound for any servers providing NTP.
    • Inbound for any clients retrieving NTP.

Dependencies

N/A

Compatibility

Compatible with the following list of operating systems:

  • CentOS 7
  • CentOS 8
  • RHEL 7.x
  • RHEL 8.x

Role Variables

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.

Example Playbook

---
- name: Manage the installation and configuration of chrony for NTP
  become: True
  gather_facts: False
  roles:
   - role: ansible_role_chrony

...

Useful shell commands

chronyc tracking
chronyc sources
chronyc sourcestats

Additional documentation resources

The following links provide more information about chrony and it's usage.

Testing with Molecule

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

CI/CD with Travis CI

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

Useful links

About

Ansible role that takes care of the installation and configuration of chrony for NTP

Resources

Stars

Watchers

Forks

Packages

No packages published