better handle datetime / ntp regarding debian version

This commit is contained in:
Ludovic Cartier
2025-11-20 17:53:37 +01:00
parent f957ca2a15
commit ecda4ecafd
3 changed files with 19 additions and 5 deletions

View File

@@ -1,4 +1,18 @@
---
- name: base | set date
- name: base | install ntp
apt:
name: ntp
state: present
when: ansible_distribution == 'Debian' and ansible_distribution_major_version | int < 13
- name: base | ensure ntp is running
service:
name: ntp
state: started
enabled: yes
when: ansible_distribution == 'Debian' and ansible_distribution_major_version | int < 13
- name: base | set date
shell:
cmd: /usr/bin/timedatectl set-timezone Europe/Paris
when: ansible_distribution == 'Debian' and ansible_distribution_major_version | int >= 13