ansible-personal/roles/common/tasks/ntp.yml
Alan Orth 7d950ade99
roles: Remove unreachable "packages" tags
After reörganizing for dynamic includes these tags will never be reached
because the children of dynamic includes do not inherit tags from their
parents as they did with static imports.
2018-04-26 16:31:06 +03:00

24 lines
833 B
YAML

---
# Hosts running Ubuntu >= 16.04 and Debian 9 use systemd init system and should
# use timedatectl as a network time client instead of the standalone ntp client.
# Earlier versions of those distros should use the ntp/ntpd package.
- name: Set timezone
when: timezone is defined and ansible_service_mgr == 'systemd'
command: /usr/bin/timedatectl set-timezone {{ timezone }}
tags: timezone
- name: Start and enable systemd's NTP client
when: ansible_service_mgr == 'systemd'
systemd: name=systemd-timesyncd state=started enabled=yes
- name: Uninstall ntp on modern Ubuntu/Debian
apt: name=ntp state=absent update_cache=yes
when: ansible_service_mgr == 'systemd'
- name: Install ntp on old Ubuntu/Debian
apt: name=ntp state=present update_cache=yes
when: ansible_service_mgr != 'systemd'
# vim: set ts=2 sw=2: