ansible-role-ntp/tasks/ntp-deb.yml

24 lines
741 B
YAML

---
- name: ntp-deb | NTP server installation
tags: ['packages', 'ntp']
when: ntp_service_enabled
block:
- name: ntp-deb | Install the ntp server
apt: pkg=ntp state=present cache_valid_time=3600
- name: ntp-deb | Install the ntp configuration.
template: src=ntp.conf.j2 dest=/etc/ntp.conf owner=root group=root mode=0644
notify: Restart the ntp server
- name: ntp-deb | Ensure that the ntp server is running
service: name=ntp state=started enabled=yes
- name: ntp-deb | NTP server installation
tags: ['packages', 'ntp']
when: not ntp_service_enabled
block:
- name: ntp-deb | Ensure that the ntp package is not installed
ansible.builtin.apt:
pkg: ntp
state: absent