40 lines
998 B
YAML
40 lines
998 B
YAML
---
|
|
|
|
- name: "manage ntp"
|
|
tags: "ntp"
|
|
block:
|
|
|
|
# install alpine
|
|
- name: "ntp - install - chrony alpine"
|
|
community.general.apk:
|
|
name: "chrony"
|
|
state: "present"
|
|
update_cache: true
|
|
when: 'ansible_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"
|
|
when: 'ansible_os_family == "Alpine"'
|
|
|
|
# install chrony
|
|
- name: "ntp - install - chrony debian"
|
|
ansible.builtin.apt:
|
|
name: "chrony"
|
|
state: "present"
|
|
when: 'ansible_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"
|