Chapter 14. Configuring time synchronization using RHEL System Roles
timesync RHEL System Role, you can manage time synchronization on multiple target machines on RHEL using Red Hat Ansible Automation Platform.
14.1. The timesync System Role
You can manage time synchronization on multiple target machines using the
timesync RHEL System Role.
timesync role installs and configures an NTP or PTP implementation to operate as an NTP client or PTP replica in order to synchronize the system clock with NTP servers or grandmasters in PTP domains.
Note that using the
timesync role also facilitates the migration to chrony, because you can use the same playbook on all versions of Red Hat Enterprise Linux starting with RHEL 6 regardless of whether the system uses
chrony to implement the NTP protocol.
14.2. Applying the timesync System Role for a single pool of servers
The following example shows how to apply the
timesync role in a situation with just one pool of servers.
timesync role replaces the configuration of the given or detected provider service on the managed host. Previous settings are lost, even if they are not specified in the role variables. The only preserved setting is the choice of provider if the
timesync_ntp_provider variable is not defined.
You have Red Hat Ansible Engine installed on the system from which you want to run the playbook.Note
You do not have to have Red Hat Ansible Automation Platform installed on the systems on which you want to deploy the
You have the
rhel-system-rolespackage installed on the system from which you want to run the playbook.
You have an inventory file which lists the systems on which you want to deploy
Create a new
playbook.ymlfile with the following content:
--- - hosts: timesync-test vars: timesync_ntp_servers: - hostname: 2.rhel.pool.ntp.org pool: yes iburst: yes roles: - rhel-system-roles.timesync
Optional: Verify playbook syntax.
# ansible-playbook --syntax-check playbook.yml
Run the playbook on your inventory file:
# ansible-playbook -i inventory_file /path/to/file/playbook.yml
Timesync System Roles variables
You can pass the following variable to the
|Role variable settings||Description|
Hostname or address of the server
Minimum polling interval. Default: 6
Maximum polling interval. Default: 10
Flag enabling fast initial synchronization. Default: no
Flag indicating that each resolved address of the hostname is a separate NTP server. Default: no
For a detailed reference on timesync role variables, install the rhel-system-roles package, and see the README.md or README.html files in the