mg
ebfe95375b
Co-authored-by: Michael Grote <michael.grote@posteo.de> Reviewed-on: mg/ansible#361 Co-authored-by: mg <michael.grote@posteo.de> Co-committed-by: mg <michael.grote@posteo.de>
57 lines
1.3 KiB
YAML
57 lines
1.3 KiB
YAML
---
|
|
|
|
- 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
|
|
notify: restart systemd-timesyncd.service
|
|
|
|
- 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 }}"
|