Page MenuHomeDevCentral

D3990.id10349.diff
No OneTemporary

D3990.id10349.diff

diff --git a/pillar/core/ntp.sls b/pillar/core/ntp.sls
new file mode 100644
--- /dev/null
+++ b/pillar/core/ntp.sls
@@ -0,0 +1,12 @@
+# -------------------------------------------------------------
+# Salt — NTP servers
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+ntp_servers:
+ - 0.fr.pool.ntp.org
+ - 1.fr.pool.ntp.org
+ - 2.fr.pool.ntp.org
+ - 3.fr.pool.ntp.org
diff --git a/pillar/top.sls b/pillar/top.sls
--- a/pillar/top.sls
+++ b/pillar/top.sls
@@ -11,6 +11,7 @@
- core.users
- core.groups
- core.network
+ - core.ntp
- nodes.nodes
- nodes.forests
- hotfixes.roles
diff --git a/roles/core/ntp/files/chrony.conf.jinja b/roles/core/ntp/files/chrony.conf.jinja
new file mode 100644
--- /dev/null
+++ b/roles/core/ntp/files/chrony.conf.jinja
@@ -0,0 +1,24 @@
+# -------------------------------------------------------------
+# Chrony configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/core/ntp/files/chrony.conf.jinja
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+{% for server in servers %}
+pool {{ server }} iburst
+{% endfor %}
+
+driftfile /var/lib/chrony/drift
+makestep 1.0 3
+rtcsync
+
+logdir /var/log/chrony
diff --git a/roles/core/ntp/files/ntp.conf.jinja b/roles/core/ntp/files/ntp.conf.jinja
new file mode 100644
--- /dev/null
+++ b/roles/core/ntp/files/ntp.conf.jinja
@@ -0,0 +1,27 @@
+# -------------------------------------------------------------
+# ntpd configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/core/ntp/files/ntp.conf.jinja
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+tos minclock 3 maxclock 6
+
+{% for server in servers %}
+pool {{ server }} iburst
+{% endfor %}
+
+restrict default limited kod nomodify notrap noquery nopeer
+restrict source limited kod nomodify notrap noquery
+restrict 127.0.0.1
+restrict ::1
+
+leapfile "/var/db/ntpd.leap-seconds.list"
diff --git a/roles/core/ntp/files/ntpdate.jinja b/roles/core/ntp/files/ntpdate.jinja
new file mode 100644
--- /dev/null
+++ b/roles/core/ntp/files/ntpdate.jinja
@@ -0,0 +1,17 @@
+# -------------------------------------------------------------
+# ntpdate — rc configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/core/ntp/files/ntpdate.jinja
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+ntpdate_enable="YES"
+ntpdate_hosts="{% for server in servers %}{{ server }}{% if not loop.last %} {% endif %}{% endfor %}"
diff --git a/roles/core/ntp/init.sls b/roles/core/ntp/init.sls
--- a/roles/core/ntp/init.sls
+++ b/roles/core/ntp/init.sls
@@ -9,6 +9,18 @@
chrony:
pkg.installed
+/etc/chrony.conf:
+ file.managed:
+ - source: salt://roles/core/ntp/files/chrony.conf.jinja
+ - template: jinja
+ - context:
+ servers: {{ salt['pillar.get']('ntp_servers') }}
+ - user: root
+ - group: root
+ - mode: 644
+ - watch_in:
+ - service: chrony_service
+
chrony_service:
service.running:
- name: chronyd
@@ -20,6 +32,22 @@
file.managed:
- source: salt://roles/core/ntp/files/rc/ntpd.conf
+/etc/ntp.conf:
+ file.managed:
+ - source: salt://roles/core/ntp/files/ntp.conf.jinja
+ - template: jinja
+ - context:
+ servers: {{ salt['pillar.get']('ntp_servers') }}
+ - watch_in:
+ - service: ntpd
+
+/etc/rc.conf.d/ntpdate:
+ file.managed:
+ - source: salt://roles/core/ntp/files/ntpdate.jinja
+ - template: jinja
+ - context:
+ servers: {{ salt['pillar.get']('ntp_servers') }}
+
ntpd:
service.running:
- enable: True

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 5, 05:44 (19 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3497361
Default Alt Text
D3990.id10349.diff (4 KB)

Event Timeline