Add playbooks/configure-chrony.yml
This commit is contained in:
53
playbooks/configure-chrony.yml
Normal file
53
playbooks/configure-chrony.yml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
- name: Configure Chrony NTP Client
|
||||||
|
hosts: all
|
||||||
|
become: true
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Ensure chrony is installed
|
||||||
|
apt:
|
||||||
|
name: chrony
|
||||||
|
state: present
|
||||||
|
update_cache: true
|
||||||
|
|
||||||
|
- name: Disable systemd-timesyncd if present
|
||||||
|
systemd:
|
||||||
|
name: systemd-timesyncd
|
||||||
|
enabled: false
|
||||||
|
state: stopped
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
|
- name: Ensure sources.d directory exists
|
||||||
|
file:
|
||||||
|
path: /etc/chrony/sources.d
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Deploy atomic source
|
||||||
|
copy:
|
||||||
|
src: files/sources.d/atomic.sources
|
||||||
|
dest: /etc/chrony/sources.d/atomic.sources
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Deploy navy source
|
||||||
|
copy:
|
||||||
|
src: files/sources.d/navy.sources
|
||||||
|
dest: /etc/chrony/sources.d/navy.sources
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Deploy fallback pool
|
||||||
|
copy:
|
||||||
|
src: files/sources.d/fallback.sources
|
||||||
|
dest: /etc/chrony/sources.d/fallback.sources
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Restart chrony to apply config
|
||||||
|
systemd:
|
||||||
|
name: chrony
|
||||||
|
state: restarted
|
||||||
|
enabled: true
|
||||||
Reference in New Issue
Block a user