xoxys.chrony/tasks/main.yml

57 lines
1.3 KiB
YAML
Raw Normal View History

2022-04-10 17:26:44 +02:00
---
2024-02-15 16:02:51 +01:00
- name: Install chrony
ansible.builtin.package:
name: chrony
state: present
2022-09-04 14:29:58 +02:00
2024-02-15 16:02:51 +01:00
- name: Create required directories
loop:
- name: /etc/systemd/system/time-sync.target.d
mode: "0755"
loop_control:
label: "{{ item.name }}"
ansible.builtin.file:
path: "{{ item.name }}"
state: directory
mode: "{{ item.mode }}"
2024-02-15 16:02:51 +01:00
- name: Deploy configuration file
ansible.builtin.template:
src: etc/chrony.conf.j2
dest: /etc/chrony.conf
owner: root
group: root
mode: "0644"
notify: __chrony_restart
2024-02-15 16:02:51 +01:00
- name: Deploy sysconfig file
ansible.builtin.template:
src: etc/sysconfig/chronyd.j2
dest: /etc/sysconfig/chronyd
owner: root
group: root
mode: "0644"
notify: __chrony_restart
2022-09-04 14:29:58 +02:00
2024-02-15 16:02:51 +01:00
- name: Deploy time-sync.target override file
ansible.builtin.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
2024-02-15 16:02:51 +01:00
- name: Ensure chronyd is up and running
ansible.builtin.service:
name: chronyd.service
state: started
daemon_reload: True
enabled: True
2024-02-15 16:02:51 +01:00
- name: Ensure chrony-wait state
ansible.builtin.service:
name: chrony-wait.service
daemon_reload: True
enabled: "{{ chrony_wait_service_enabled | bool }}"