timesyncd: rename variable ntp_servers to timesyncd_ntp_servers and check for minimum number of elements

This commit is contained in:
Jérémy Lecour 2023-10-14 07:07:57 +02:00 committed by Jérémy Lecour
parent 9c56cff642
commit 86e753b7a0
Signed by: jlecour
SSH key fingerprint: SHA256:h+5LgHRKwN9lS0SsdVR5yZPeFlJE4Mt+8UtL4CcP8dY
3 changed files with 9 additions and 3 deletions

View file

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

View file

@ -1,4 +1,10 @@
---
- name: Verify that at least 1 NTP server is provided
ansible.builtin.assert:
that: timesyncd_ntp_servers | length > 0
msg: The variable timesyncd_ntp_servers must contain at least 1 element
- name: Install systemd-timesyncd package
ansible.builtin.apt:
name: systemd-timesyncd

View file

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