Add chrony.yml

This commit is contained in:
2025-07-20 18:56:09 +02:00
parent af251dd89f
commit 330f8a0a51

27
chrony.yml Normal file
View File

@@ -0,0 +1,27 @@
---
- name: Configure NTP with Chrony
hosts: all
become: yes
vars:
chrony_servers:
- 0.pool.ntp.org
- 1.pool.ntp.org
tasks:
- name: Install chrony
apt:
name: chrony
state: present
update_cache: yes
- name: Configure NTP servers
lineinfile:
path: /etc/chrony/chrony.conf
regexp: '^server'
line: "server {{ item }} iburst"
loop: "{{ chrony_servers }}"
- name: Restart chrony
service:
name: chrony
state: restarted
enabled: yes