21 lines
687 B
YAML
21 lines
687 B
YAML
---
|
|
# tasks file for systemd-timesyncd
|
|
- block:
|
|
- name: "set timezone"
|
|
community.general.timezone:
|
|
name: "{{ timezone }}"
|
|
- name: "configure systemd-timesyncd"
|
|
lineinfile:
|
|
path: /etc/systemd/timesyncd.conf
|
|
regexp: '{{ item.regexp }}'
|
|
line: '{{ item.line }}'
|
|
loop:
|
|
- { 'regexp': '^#*NTP=.*$', 'line': 'NTP={{ ntp | default("") | join(" ") }}'}
|
|
- { 'regexp': '^#*FallbackNTP=.*$', 'line': 'FallbackNTP={{ fallback_ntp | default("") | join(" ") }}'}
|
|
- name: "start and enable systemd-timesyncd"
|
|
service:
|
|
name: systemd-timesyncd.service
|
|
enabled: yes
|
|
state: started
|
|
notify: systemd-timesyncd configuration changed
|