Add chrony.yml
This commit is contained in:
27
chrony.yml
Normal file
27
chrony.yml
Normal 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
|
||||||
Reference in New Issue
Block a user