common/tasks/ntp.yaml
Simon Cornet 210fbd68f4
All checks were successful
ci/woodpecker/push/linting Pipeline was successful
chore: cleanup tag mess
Tag only in main.yaml, tasks inherit them.
2026-05-20 09:40:02 +02:00

40 lines
1 KiB
YAML

---
- name: "manage ntp"
block:
# install alpine
- name: "ntp - install - chrony alpine"
community.general.apk:
name: "chrony"
state: "present"
update_cache: true
when: 'ansible_facts["os_family"] == "Alpine"'
# create keys file
- name: "ntp - chrony keys file"
ansible.builtin.file:
path: "/etc/chrony/chrony.keys"
owner: "chrony"
group: "chrony"
mode: "0440"
state: "touch"
notify: "restart chrony"
when: 'ansible_facts["os_family"] == "Alpine"'
# install chrony
- name: "ntp - install - chrony debian"
ansible.builtin.apt:
name: "chrony"
state: "present"
when: 'ansible_facts["os_family"] == "Debian"'
# configure chrony
- name: "ntp - config - configure chrony"
ansible.builtin.template:
src: "templates/chrony/chrony.conf.j2"
dest: "/etc/chrony/chrony.conf"
owner: "root"
group: "root"
mode: "0644"
notify: "restart chrony"