@@ -0,0 +1,22 @@ | |||
{%- set config = salt['pillar.get']('chrony:config', {}) -%} | |||
# This file is managed by salt | |||
{% for server in config.ntpservers -%} | |||
server {{ server }} {{ config.options }} | |||
{% endfor %} | |||
keyfile {{ config.keyfile }} | |||
driftfile {{ config.keyfile }} | |||
{% if config.allow is defined %} | |||
{% for allowed in config.get('allow', []) -%} | |||
allow {{ allowed }} | |||
{% endfor %} | |||
{% endif %} | |||
logdir {{ config.logdir }} | |||
{% for param in config.get('miscparams', []) -%} | |||
{{ param }} | |||
{% endfor %} |
@@ -0,0 +1,21 @@ | |||
{% from "chrony/map.jinja" import chrony with context %} | |||
chrony: | |||
pkg.installed: | |||
- name: {{ chrony.package }} | |||
service.running: | |||
- enable: True | |||
- name: {{ chrony.service }} | |||
- require: | |||
- pkg: {{ chrony.package }} | |||
chrony_config: | |||
file.managed: | |||
- name: {{ chrony.config }} | |||
- source: {{ chrony.config_src }} | |||
- template: jinja | |||
- user: root | |||
- mode: 644 | |||
- watch_in: | |||
- service: {{ chrony.service }} | |||
@@ -0,0 +1,15 @@ | |||
{% set chrony = salt['grains.filter_by']({ | |||
'Debian': { | |||
'package': 'chrony', | |||
'service': 'chronyd', | |||
'config': '/etc/chrony/chrony.conf', | |||
'config_src': 'salt://chrony/files/chrony_config', | |||
}, | |||
'RedHat': { | |||
'package': 'chrony', | |||
'service': 'chronyd', | |||
'config': '/etc/chrony.conf', | |||
'config_src': 'salt://chrony/files/chrony_config', | |||
}, | |||
}, | |||
merge=salt['pillar.get']('chrony:config')) %} |