---

- name: NTP | INCLUDE_VARS
  ansible.builtin.include_vars: "vars.yml"

- name: NTP | install NTP daemon
  ansible.builtin.apt:
    pkg: openntpd
    state: present

- name: NTP | deploy OpenNTPd configuration file
  ansible.builtin.template:
    src: templates/ntpd.conf.j2
    dest: /etc/openntpd/ntpd.conf
    mode: 0644
    owner: root
    group: root
  register: openntpd_cfg

- name: restart openntpd
  when: openntpd_cfg.changed
  ansible.builtin.service:
    name: openntpd
    state: restarted
