idiv_biodiversity.systemd_timesyncd
Ansible Role: systemd-timesyncd
This Ansible role sets up systemd-timesyncd for time synchronization.
Table of Contents
Requirements
- Ansible version 2.9 or higher.
Role Variables
Time Zone
Specify the system time zone. Make sure to set this as there is no default value. Use the prefix system_
so it's clear that this variable can work with other roles.
system_timezone: Europe/Berlin
NTP Servers
List the preferred NTP servers for your network. These should be your internal NTP servers.
ntp_servers:
- ntp1.domain.org
- ntp2.domain.org
- ntp3.domain.org
For backup, use regional pools:
ntp_fallback_servers:
- 0.europe.pool.ntp.org
- 1.europe.pool.ntp.org
- 2.europe.pool.ntp.org
- 3.europe.pool.ntp.org
Purge Legacy Packages
Decide whether to remove old time synchronization packages (like ntp and chrony):
systemd_timesyncd_purge_legacy_packages: yes
Dependencies
---
# requirements.yml
collections:
- name: community.general
version: X.Y.Z
roles:
- name: idiv_biodiversity.systemd_timesyncd
src: https://github.com/idiv-biodiversity/ansible-role-systemd-timesyncd
version: vX.Y.Z
...
Example Playbook
Top-Level Playbook
Here is an example of a top-level playbook:
---
- name: head server
hosts: head
roles:
- role: idiv_biodiversity.systemd_timesyncd
tags:
- systemd
- systemd-timesyncd
- timesync
...
Role Dependency
To set a role dependency, add this in meta/main.yml
:
---
dependencies:
- role: idiv_biodiversity.systemd_timesyncd
tags:
- systemd
- systemd-timesyncd
- timesync
...
Tags
You can use these tags to run specific parts of the role:
timezone
: only set the time zone.systemd-timesyncd
: configure the timesyncd.conf file and restart the service if needed.service
,service-timesyncd
, andtimesyncd-service
: enable and start the service; theservice
tag allows you to enable and start all services across roles, for example:ansible-playbook site.yml -t service
.
In the example playbook, the tags are timesyncd
and timesync
. The timesync
tag is useful if you change between different time synchronization roles.
License
MIT
Author Information
This role was created in 2017 by Christian Krause aka wookietreiber, an HPC cluster systems administrator at the German Centre for Integrative Biodiversity Research (iDiv).
install and configure systemd-timesyncd
ansible-galaxy install idiv_biodiversity.systemd_timesyncd