2022-02-18 20:34:43 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: gather package facts
|
|
|
|
become: yes
|
|
|
|
ansible.builtin.package_facts:
|
|
|
|
manager: auto
|
|
|
|
|
|
|
|
# deaktiviere andere ntp-implementationen
|
|
|
|
- name: stop and mask ntp service
|
|
|
|
become: yes
|
|
|
|
systemd:
|
|
|
|
name: ntp
|
|
|
|
masked: yes
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
when: "'ntp' in ansible_facts.packages"
|
|
|
|
|
|
|
|
- name: stop and mask chrony service
|
|
|
|
become: yes
|
|
|
|
systemd:
|
|
|
|
name: chrony
|
|
|
|
masked: yes
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
when: "'chrony' in ansible_facts.packages"
|
|
|
|
|
|
|
|
- name: install systemd-timesyncd
|
|
|
|
become: yes
|
|
|
|
ansible.builtin.package:
|
|
|
|
name:
|
|
|
|
- systemd-timesyncd
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: template systemd-timesyncd config
|
|
|
|
become: yes
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "timesyncd.conf.j2"
|
|
|
|
dest: "/etc/systemd/timesyncd.conf"
|
|
|
|
mode: 0644
|
|
|
|
owner: root
|
|
|
|
group: root
|
2022-05-10 06:42:37 +02:00
|
|
|
notify: restart systemd-timesyncd.service
|
2022-02-18 20:34:43 +01:00
|
|
|
|
|
|
|
- name: activate systemd-timesyncd service (not within containers like lxc)
|
|
|
|
become: yes
|
|
|
|
systemd:
|
|
|
|
name: systemd-timesyncd
|
|
|
|
masked: no
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
when: not ansible_facts['virtualization_type'] == "lxc"
|
|
|
|
tags: test
|
|
|
|
|
|
|
|
- name: set timezone to {{ ntp_timesyncd_timezone }}
|
|
|
|
become: yes
|
|
|
|
ansible.builtin.timezone:
|
|
|
|
name: "{{ ntp_timesyncd_timezone }}"
|