forked from ISTI-ansible-roles/ansible-roles
39 lines
1.2 KiB
YAML
39 lines
1.2 KiB
YAML
|
---
|
||
|
- block:
|
||
|
- name: Install the ntp server
|
||
|
apt: pkg=ntp state=present valid_cache_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
|
||
|
|
||
|
when: ansible_distribution_file_variety == "RedHat"
|
||
|
tags: [ 'packages', 'ntp' ]
|