2016-08-25 13:19:51 +02:00
|
|
|
---
|
2019-07-01 23:12:32 +02:00
|
|
|
# Hosts running Ubuntu 16.04+ and Debian 9+ use systemd init system and should
|
2016-08-25 13:19:51 +02:00
|
|
|
# use timedatectl as a network time client instead of the standalone ntp client.
|
2021-02-11 22:17:34 +01:00
|
|
|
# Alpine can use chrony.
|
2016-08-25 13:19:51 +02:00
|
|
|
|
|
|
|
- name: Set timezone
|
|
|
|
when: timezone is defined and ansible_service_mgr == 'systemd'
|
|
|
|
command: /usr/bin/timedatectl set-timezone {{ timezone }}
|
|
|
|
tags: timezone
|
|
|
|
|
2017-11-02 17:55:20 +01:00
|
|
|
- name: Start and enable systemd's NTP client
|
2016-08-25 13:19:51 +02:00
|
|
|
when: ansible_service_mgr == 'systemd'
|
2017-11-02 17:55:20 +01:00
|
|
|
systemd: name=systemd-timesyncd state=started enabled=yes
|
2016-08-25 13:19:51 +02:00
|
|
|
|
|
|
|
- name: Uninstall ntp on modern Ubuntu/Debian
|
|
|
|
apt: name=ntp state=absent update_cache=yes
|
2017-11-05 00:19:28 +01:00
|
|
|
when: ansible_service_mgr == 'systemd'
|
2016-08-25 13:19:51 +02:00
|
|
|
|
2021-02-11 22:17:34 +01:00
|
|
|
- name: Install chronyd on Alpine
|
|
|
|
apt: name=chrony state=present
|
|
|
|
when: ansible_distribution == 'Alpine'
|
|
|
|
|
2016-08-25 13:19:51 +02:00
|
|
|
# vim: set ts=2 sw=2:
|