48 lines
1.0 KiB
YAML
48 lines
1.0 KiB
YAML
---
|
|
- name: Install chrony
|
|
ansible.builtin.package:
|
|
name: chrony
|
|
state: present
|
|
|
|
- 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 }}"
|
|
|
|
- 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
|
|
|
|
- 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
|
|
|
|
- name: Ensure chronyd is up and running
|
|
ansible.builtin.service:
|
|
name: chronyd.service
|
|
state: started
|
|
daemon_reload: True
|
|
enabled: True
|
|
|
|
- name: Ensure chrony-wait state
|
|
ansible.builtin.service:
|
|
name: chrony-wait.service
|
|
daemon_reload: True
|
|
enabled: "{{ chrony_wait_service_enabled | bool }}"
|