Browse Source

First commit

fixconfig
mraymond77 9 years ago
commit
278329745f
3 changed files with 58 additions and 0 deletions
  1. +22
    -0
      chrony/files/chrony_config
  2. +21
    -0
      chrony/init.sls
  3. +15
    -0
      chrony/map.jinja

+ 22
- 0
chrony/files/chrony_config View File

@@ -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 %}

+ 21
- 0
chrony/init.sls View File

@@ -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 }}


+ 15
- 0
chrony/map.jinja View File

@@ -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')) %}

Loading…
Cancel
Save