48 lines
1.0 KiB
YAML
48 lines
1.0 KiB
YAML
---
|
|
|
|
# ---
|
|
# NTP Server
|
|
# ---
|
|
|
|
- name: (ntp.yml) Ensure ntp package is installed.
|
|
apt:
|
|
name:
|
|
- ntp
|
|
state: present
|
|
when:
|
|
- ansible_os_family == "Debian"
|
|
- groups['file_server']|string is search(inventory_hostname)
|
|
tags:
|
|
- ntp-server
|
|
|
|
- name: (ntp.yml) Check file '/etc/ntp.conf.ORIG' exists
|
|
stat:
|
|
path: /etc/ntp.conf.ORIG
|
|
register: etc_ntp_conf_ORIG
|
|
when:
|
|
- groups['file_server']|string is search(inventory_hostname)
|
|
tags:
|
|
- ntp-server
|
|
|
|
- name: (ntp.yml) Backup installation version of file '/etc/ntp.conf'
|
|
command: cp -a /etc/ntp.conf /etc/ntp.conf.ORIG
|
|
when:
|
|
- groups['file_server']|string is search(inventory_hostname)
|
|
- etc_ntp_conf_ORIG.stat.exists == False
|
|
tags:
|
|
- ntp-server
|
|
|
|
- name: (ntp.yml) Update '/etc/ntp.conf'
|
|
template:
|
|
src: "etc/ntp.conf.j2"
|
|
dest: /etc/ntp.conf
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
notify: Restart ntp
|
|
when:
|
|
- groups['file_server']|string is search(inventory_hostname)
|
|
tags:
|
|
- ntp-server
|
|
|