From 6bfc45d4c88a8ab44d2a29cd8d2392d18304dc1a Mon Sep 17 00:00:00 2001 From: Joshua Schmidlkofer Date: Thu, 11 Aug 2016 22:31:21 -0700 Subject: [PATCH 1/2] ntp daemon options: commit a solution for RHEL7 --- ntp/ng/init.sls | 19 +++++++++++++++++++ ntp/ng/map.jinja | 14 +++++++++++--- pillar.example | 7 +++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/ntp/ng/init.sls b/ntp/ng/init.sls index 486e924..0ded820 100644 --- a/ntp/ng/init.sls +++ b/ntp/ng/init.sls @@ -40,3 +40,22 @@ ntpd: - watch: - file: ntpd_conf {% endif %} + +{#% if 'defaults' in ntp.lookup %#} +ntpd_defaults: + file.managed: + - name: {{ ntp.lookup.defaults }} + - user: root + - group: root + - mode: 0664 + - contents: | + # Options for ntpdate + OPTIONS="{{ ntp.service.options }}" + + # Number of retries before giving up + RETRIES={{ ntp.service.retries }} + + # Set to 'yes' to sync hw clock after successful ntpdate + SYNC_HWCLOCK={{ ntp.service.sync_hwclock }} + +{#% endif %#} diff --git a/ntp/ng/map.jinja b/ntp/ng/map.jinja index 64bc7cd..15cb793 100644 --- a/ntp/ng/map.jinja +++ b/ntp/ng/map.jinja @@ -17,7 +17,8 @@ 'RedHat': { 'package': 'ntp', 'service': 'ntpd', - 'ntp_conf': '/etc/ntp.conf' + 'ntp_conf': '/etc/ntp.conf', + 'defaults': '/etc/sysconfig/ntpdate' }, 'Suse': { 'package': 'ntp', @@ -40,6 +41,13 @@ 'restrict': ['default noquery nopeer', '127.0.0.1', '::1'], 'driftfile': [ default_driftfile ] } + }), + 'service': { 'options': '-p 2', + 'retries': '2', + 'sync_hwclock': 'no', + } + + } + %} - }) -} %} +{% do ntp.service.update( salt['pillar.get']('ntp:ng:service', {})) %} \ No newline at end of file diff --git a/pillar.example b/pillar.example index a90a16c..ed355b8 100644 --- a/pillar.example +++ b/pillar.example @@ -53,6 +53,11 @@ ntp: ng: # OS-specific data that should, in most cases, be handled by map.jinja. # It is an optional key and is only used to override defaults. + daemon: + # overrides daemon startup options + options: -p 2 + retries: 2 + sync_hwclock: False lookup: package: ntp service: ntpd @@ -60,6 +65,8 @@ ntp: ntp_conf: /etc/ntp.conf # State-specific options settings: + # if `yes`, set flags to update the hardware after sync + sync_hwclock: no # If `True`, ntpd will be enabled. Otherwise ntp.conf will be configured # but ntpd will not be enabled or started. ntpd: True From 68ff17d8b5c4f118a2d105f82e985ace3cff1556 Mon Sep 17 00:00:00 2001 From: Joshua Schmidlkofer Date: Thu, 11 Aug 2016 22:32:01 -0700 Subject: [PATCH 2/2] documentation fix --- pillar.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pillar.example b/pillar.example index ed355b8..5f660ce 100644 --- a/pillar.example +++ b/pillar.example @@ -53,7 +53,7 @@ ntp: ng: # OS-specific data that should, in most cases, be handled by map.jinja. # It is an optional key and is only used to override defaults. - daemon: + service: # overrides daemon startup options options: -p 2 retries: 2