update..
This commit is contained in:
@ -4,10 +4,10 @@
|
||||
# NTP Server
|
||||
# ---
|
||||
|
||||
- name: (ntp.yml) Ensure ntp package is installed.
|
||||
- name: (ntp.yml) Ensure ntpsec package is installed.
|
||||
apt:
|
||||
name:
|
||||
- ntp
|
||||
- ntpsec
|
||||
state: present
|
||||
when:
|
||||
- ansible_os_family == "Debian"
|
||||
@ -15,27 +15,39 @@
|
||||
tags:
|
||||
- ntp-server
|
||||
|
||||
- name: (ntp.yml) Check file '/etc/ntp.conf.ORIG' exists
|
||||
- name: (ntp.yml) Check file '/etc/ntpsec/ntp.conf.ORIG' exists
|
||||
stat:
|
||||
path: /etc/ntp.conf.ORIG
|
||||
register: etc_ntp_conf_ORIG
|
||||
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) Backup installation version of file '/etc/ntp.conf'
|
||||
command: cp -a /etc/ntp.conf /etc/ntp.conf.ORIG
|
||||
|
||||
- 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 -a /etc/ntpsec/ntp.conf /etc/ntpsec/ntp.conf.ORIG
|
||||
when:
|
||||
- groups['file_server']|string is search(inventory_hostname)
|
||||
- etc_ntp_conf_ORIG.stat.exists == False
|
||||
- etc_ntpsec_conf_ORIG.stat.exists == False
|
||||
tags:
|
||||
- ntp-server
|
||||
|
||||
- name: (ntp.yml) Update '/etc/ntp.conf'
|
||||
- name: (ntp.yml) Update '/etc/ntpsec/ntp.conf'
|
||||
template:
|
||||
src: "etc/ntp.conf.j2"
|
||||
dest: /etc/ntp.conf
|
||||
src: "etc/ntpsec/ntp.conf.j2"
|
||||
dest: /etc/ntpsec/ntp.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
|
Reference in New Issue
Block a user