2021-03-13 12:32:54 +01:00
|
|
|
---
|
2021-03-13 18:48:41 +01:00
|
|
|
- name: mask systemd-timesyncd service
|
|
|
|
become: yes
|
|
|
|
systemd:
|
|
|
|
name: systemd-timesyncd
|
|
|
|
state: stopped
|
|
|
|
masked: yes
|
|
|
|
|
2021-03-27 10:46:48 +01:00
|
|
|
- name: stop ntp service
|
2021-03-13 18:48:41 +01:00
|
|
|
become: yes
|
|
|
|
systemd:
|
|
|
|
name: ntp
|
|
|
|
state: stopped
|
2021-03-27 10:46:48 +01:00
|
|
|
notify: mask ntp service
|
2021-03-13 19:49:02 +01:00
|
|
|
|
2021-03-13 12:32:54 +01:00
|
|
|
- name: install chrony packages
|
|
|
|
become: yes
|
|
|
|
ansible.builtin.package:
|
|
|
|
name:
|
|
|
|
- chrony
|
|
|
|
state: present
|
2021-03-13 19:50:01 +01:00
|
|
|
notify: restart_chrony
|
2021-03-13 12:32:54 +01:00
|
|
|
|
|
|
|
- name: copy chrony config
|
|
|
|
become: yes
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: chrony.conf.j2
|
|
|
|
dest: /etc/chrony/chrony.conf
|
2021-03-13 19:49:02 +01:00
|
|
|
mode: 0755
|
2021-03-13 12:32:54 +01:00
|
|
|
notify: restart_chrony
|
|
|
|
|
|
|
|
- name: copy logrotate config
|
|
|
|
become: yes
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: logrotate_chrony
|
|
|
|
dest: /etc/logrotate.d/chrony
|
2021-03-13 22:11:57 +01:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
2021-03-13 12:32:54 +01:00
|
|
|
- name: Create chrony driftfile folder
|
|
|
|
become: yes
|
|
|
|
file:
|
|
|
|
state: directory
|
|
|
|
path: "{{ ntp_chrony_driftfile_directory }}"
|
2021-03-13 19:49:02 +01:00
|
|
|
mode: 0755
|
2021-03-13 12:32:54 +01:00
|
|
|
owner: "{{ ntp_chrony_user }}"
|
|
|
|
group: "{{ ntp_chrony_group }}"
|
2021-03-13 19:50:01 +01:00
|
|
|
notify: restart_chrony
|
2021-03-13 12:32:54 +01:00
|
|
|
|
|
|
|
- name: set timezone to {{ ntp_chrony_timezone }}
|
|
|
|
become: yes
|
|
|
|
ansible.builtin.timezone:
|
|
|
|
name: "{{ ntp_chrony_timezone }}"
|