base: use a template for ntp configuration to ease the management of the different cases
This commit is contained in:
parent
ec6de426d6
commit
d10b2c42b3
|
@ -51,6 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
* base: configure "/usr/X11R6" and "/usr/local" for servers that have a mount on it
|
||||
* base: we can chose to deploy or not utils files
|
||||
* base: reordering default variable file and deleting unused one
|
||||
* base: use a template for ntp configuration to ease the management of the different cases
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ general_alert_email: "root@localhost"
|
|||
cron_root_path: "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
|
||||
|
||||
# ntp.yml
|
||||
is_ntpd_server: false
|
||||
ntpd_servers: "ntp.evolix.net"
|
||||
|
||||
# fstab.yml
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
args:
|
||||
warn: false
|
||||
|
||||
- name: reload ntp
|
||||
- name: restart ntpd
|
||||
service:
|
||||
name: ntpd
|
||||
state: restarted
|
||||
|
|
|
@ -1,31 +1,12 @@
|
|||
---
|
||||
- name: "Retrieve ntpd.conf content"
|
||||
command: cat ntpd.conf
|
||||
args:
|
||||
chdir: /etc/
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
register: ntpd_conf
|
||||
tags:
|
||||
- ntp
|
||||
|
||||
- name: "Empty ntpd.conf before customizing it"
|
||||
file:
|
||||
path: /etc/ntpd.conf
|
||||
state: absent
|
||||
when: ntpd_conf.stdout is not regex('^servers ' + ntpd_servers + '$')
|
||||
tags:
|
||||
- ntp
|
||||
|
||||
- name: "Customize ntpd conf"
|
||||
lineinfile:
|
||||
path: /etc/ntpd.conf
|
||||
line: "servers {{ ntpd_servers }}"
|
||||
create: true
|
||||
template:
|
||||
src: ntpd.conf.j2
|
||||
dest: /etc/ntpd.conf
|
||||
owner: root
|
||||
group: wheel
|
||||
mode: '0644'
|
||||
notify:
|
||||
- reload ntp
|
||||
- restart ntpd
|
||||
tags:
|
||||
- ntp
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{% if is_ntpd_server %}
|
||||
listen on *
|
||||
{% endif %}
|
||||
servers {{ ntpd_servers }}
|
Loading…
Reference in New Issue