32 lines
523 B
YAML
32 lines
523 B
YAML
|
---
|
||
|
- hosts: all
|
||
|
|
||
|
tasks:
|
||
|
|
||
|
- name: Install NTP
|
||
|
package:
|
||
|
name: ntp
|
||
|
state: latest
|
||
|
|
||
|
- name: Debug
|
||
|
debug: var=ntp_servers
|
||
|
|
||
|
- name: Copy ntp.conf
|
||
|
template:
|
||
|
src: ntp.conf.j2
|
||
|
dest: /etc/ntp.conf
|
||
|
backup: yes
|
||
|
notify: Restart NTP
|
||
|
|
||
|
- name: Enable NTP
|
||
|
service:
|
||
|
name: "{{ ntp_service_name }}"
|
||
|
enabled: yes
|
||
|
state: started
|
||
|
|
||
|
|
||
|
handlers:
|
||
|
- name: Restart NTP
|
||
|
service: "name={{ ntp_service_name }} state=\"restarted\""
|
||
|
|