New timesyncd role used instead of ntpd by default

This commit is contained in:
David Prevot 2023-08-24 18:08:16 +02:00
parent aa13171f91
commit ca67feb39e
6 changed files with 59 additions and 2 deletions

View File

@ -104,7 +104,8 @@ evolinux_system_locales: True
evolinux_system_set_timezone: True
evolinux_system_timezone: "Europe/Paris"
evolinux_system_include_ntpd: true
evolinux_system_include_ntpd: False
evolinux_system_include_timesyncd: True
evolinux_system_vim_skip_defaults: True
evolinux_system_vim_default_editor: True
@ -233,4 +234,4 @@ evolinux_cron_checkhpraid_frequency: daily
evolinux_motd_include: True
# Utils
evolinux_utils_include: True
evolinux_utils_include: True

View File

@ -134,6 +134,11 @@
when:
- evolinux_system_include_ntpd | bool
- ansible.builtin.include_role:
name: evolix/timesyncd
when:
- evolinux_system_include_timesyncd | bool
## alert5
- name: Install alert5 init script (jessie/stretch)

View File

@ -0,0 +1,3 @@
---
ntp_servers:
- 'ntp.evolix.net'

View File

@ -0,0 +1,5 @@
---
- name: Restart timesyncd
ansible.builtin.service:
name: systemd-timesyncd.service
state: restarted

40
timesyncd/tasks/main.yml Normal file
View File

@ -0,0 +1,40 @@
---
- name: Install systemd-timesyncd package
ansible.builtin.apt:
name: systemd-timesyncd
state: present
tags:
- timesyncd
- name: Remove openntpd package
ansible.builtin.apt:
name: openntpd
state: absent
tags:
- timesyncd
- name: Remove ntp package
ansible.builtin.apt:
name: ntp
state: absent
tags:
- timesyncd
- name: Ensure /etc/systemd/timesyncd.conf.d directory exists
file:
path: /etc/systemd/timesyncd.conf.d
state: directory
mode: "755"
owner: root
group: root
tags:
- timesyncd
- name: Copy timesyncd config
ansible.builtin.template:
src: timesyncd.conf.j2
dest: /etc/systemd/timesyncd.conf.d/evolix.conf
mode: "0644"
notify: Restart timesyncd
tags:
- timesyncd

View File

@ -0,0 +1,3 @@
# {{ ansible_managed }}
[Time]
NTP="{{ ntp_servers | join(' ') }}"