This commit is contained in:
135
2023-08-25 14:50:25 +03:00
commit fac600c19e
8 changed files with 144 additions and 0 deletions

20
tasks/main.yml Normal file
View File

@@ -0,0 +1,20 @@
---
# 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