xoxys.chrony/tasks/main.yml

60 lines
1.4 KiB
YAML
Raw Normal View History

2022-04-10 15:26:44 +00:00
---
2022-09-04 12:29:58 +00:00
- block:
- name: Install chrony
package:
name: chrony
state: present
2023-06-05 19:48:39 +00:00
- name: Create required directories
loop:
- name: /etc/systemd/system/time-sync.target.d
mode: "0755"
loop_control:
label: "{{ item.name }}"
file:
path: "{{ item.name }}"
state: directory
mode: "{{ item.mode }}"
2022-09-04 12:29:58 +00:00
- name: Deploy configuration file
template:
src: etc/chrony.conf.j2
dest: /etc/chrony.conf
owner: root
group: root
mode: 0644
notify: __chrony_restart
- name: Deploy sysconfig file
template:
src: etc/sysconfig/chronyd.j2
dest: /etc/sysconfig/chronyd
owner: root
group: root
2022-09-04 12:29:58 +00:00
mode: 0644
notify: __chrony_restart
2023-06-05 19:48:39 +00:00
- name: Deploy time-sync.target override file
template:
src: etc/systemd/system/time-sync.target.d/requires.conf.j2
dest: /etc/systemd/system/time-sync.target.d/requires.conf
owner: root
group: root
mode: 0644
notify: __chrony_restart
- name: Ensure chronyd is up and running
2022-09-04 12:29:58 +00:00
systemd:
name: chronyd.service
state: started
daemon_reload: True
enabled: True
2023-06-05 19:48:39 +00:00
- name: Ensure chrony-wait is enabled
systemd:
name: chrony-wait.service
daemon_reload: True
enabled: True
2022-09-04 12:29:58 +00:00
become: True
become_user: root