home-server/roles/ntp/tasks/main.yml

34 lines
877 B
YAML

---
# The home-server project produces a multi-purpose setup using Ansible.
# Copyright © 2018 Y. Gablin, under the GPL-3.0-or-later license.
# Full licensing information in the LICENSE file, or gnu.org/licences/gpl-3.0.txt if the file is missing.
- name: create systemd override-directories
file:
path: /etc/systemd/timesyncd.conf.d
state: directory
mode: 0755
- name: configure systemd NTP
copy:
content: |
[Time]
NTP={{ntp_hosts}}
dest: "/etc/systemd/timesyncd.conf.d/{{nickname}}.conf"
mode: 0644
notify: restart NTP
- name: enable NTP
systemd:
daemon_reload: true
name: systemd-timesyncd.service
enabled: true
### LOCAL COMMIT ⇒ ###
- name: commit local changes
include_role: name=etckeeper.inc allow_duplicates=true tasks_from=local.yml
vars:
msg: NTP
### ⇐ LOCAL COMMIT ###
- meta: flush_handlers