Skip to content
Snippets Groups Projects
Commit 34fb05bd authored by Jan Philipp Timme's avatar Jan Philipp Timme
Browse files

Introduce systemd-timesyncd to hshbase

parent 90a1247e
No related branches found
No related tags found
No related merge requests found
{%- from "hshbase/map.jinja" import hshbase with context -%}
### THIS FILE IS MANAGED BY SALT!
### YOUR CHANGES WILL BE OVERWRITTEN!
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift
# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
# You do need to talk to an NTP server or two (or three).
server {{ hshbase['time']['server'] }} iburst
# pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will
# pick a different set every time it starts up. Please consider joining the
# pool: <http://www.pool.ntp.org/join.html>
server 0.debian.pool.ntp.org iburst
server 1.debian.pool.ntp.org iburst
server 2.debian.pool.ntp.org iburst
server 3.debian.pool.ntp.org iburst
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
### THIS FILE IS MANAGED BY SALT via `hshbase` formula! YOUR CHANGES WILL BE OVERWRITTEN!
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See timesyncd.conf(5) for details.
[Time]
NTP=time.hs-hannover.de
#FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048
{% from "hshbase/map.jinja" import hshbase with context %} {% from "hshbase/map.jinja" import hshbase with context %}
{% if (grains['os'] == 'Debian' and grains['osmajorrelease'] >= 10) or grains['os'] == 'Ubuntu' and grains['osmajorrelease'] >= 18 %} hsh_server_timezone:
timezone.system:
- name: {{ hshbase.time.zone }}
ntp:
pkg.purged
/etc/ntp.conf: hsh_remove_ntp_config:
file.absent: file.absent:
- require: - name: /etc/ntp.conf
- pkg: ntp
hsh_ntp_service_not_running: hsh_ntp_service_not_running:
service.disabled: service.disabled:
- name: ntp - name: ntp
hsh_purge_ntp:
pkg.purged:
- name: ntp
- require: - require:
- file: /etc/ntp.conf - file: hsh_remove_ntp_config
- pkg: ntp - service: hsh_ntp_service_not_running
{% endif %}
hsh_server_timezone: hsh_systemd_timesyncd_present:
timezone.system: pkg.install:
- name: {{ hshbase.time.zone }} - name: systemd-timesyncd
hsh_systemd_timesyncd_configured:
file.managed:
- name: /etc/systemd/timesyncd.conf
- source: salt://hshbase-formula/hshbase/time/timesyncd.conf
- require:
- pkg: hsh_systemd_timesyncd_present
hsh_systemd_timesyncd_service_running:
service.running:
- name: systemd-timesyncd
- enabled: True
- restart: True
- require:
- file: hsh_systemd_timesyncd_configured
- watch:
- file: hsh_systemd_timesyncd_configured
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment