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