43 lines
1.5 KiB
YAML
43 lines
1.5 KiB
YAML
---
|
|
- block:
|
|
- name: Install the ntp server
|
|
apt: pkg=ntp state=present cache_valid_time=3600
|
|
|
|
- name: 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: Ensure that the ntp server is running
|
|
service: name=ntp state=started enabled=yes
|
|
when: ntp_service_enabled | bool
|
|
|
|
- name: Ensure that the ntp server is stopped and disabled
|
|
service: name=ntp state=stopped enabled=no
|
|
when: not ntp_service_enabled | bool
|
|
|
|
when: ansible_distribution_file_variety == "Debian"
|
|
tags: [ 'packages', 'ntp' ]
|
|
|
|
- block:
|
|
- name: Install the ntpd server
|
|
yum: pkg=ntp state=present
|
|
|
|
- name: Install the ntp configuration.
|
|
template: src=ntp-centos.conf.j2 dest=/etc/ntp.conf owner=root group=root mode=0644
|
|
notify: Restart the ntpd server
|
|
|
|
- name: Ensure that the ntpd server is running
|
|
service: name=ntpd state=started enabled=yes
|
|
when: ntp_service_enabled | bool
|
|
|
|
- name: Ensure that the ntpd server is stopped and disabled
|
|
service: name=ntpd state=stopped enabled=no
|
|
when: not ntp_service_enabled | bool
|
|
|
|
- name: Manage services firewalld rules. Services names must be the known ones. Save the services that are meant to be permanent
|
|
firewalld: service=ntp zone=public permanent=True state=enabled immediate=True
|
|
when: firewalld_enabled | bool
|
|
|
|
when: ansible_distribution_file_variety == "RedHat"
|
|
tags: [ 'packages', 'ntp' ]
|