Explorar el Código

Added default config parameters for Debian and RHEL to map.jinja

tags/v0.2.0
mraymond77 hace 9 años
padre
commit
51b18c59f4
Se han modificado 2 ficheros con 67 adiciones y 14 borrados
  1. +4
    -5
      chrony/files/chrony_config
  2. +63
    -9
      chrony/map.jinja

+ 4
- 5
chrony/files/chrony_config Ver fichero

{%- set config = salt['pillar.get']('chrony:config', {}) -%}

{% from "chrony/map.jinja" import chrony as config with context %}
# This file is managed by salt # This file is managed by salt
{% for server in config.ntpservers -%} {% for server in config.ntpservers -%}
server {{ server }} {{ config.options }} server {{ server }} {{ config.options }}


keyfile {{ config.keyfile }} keyfile {{ config.keyfile }}


driftfile {{ config.keyfile }}
driftfile {{ config.driftfile }}


{% if config.allow is defined %} {% if config.allow is defined %}
{% for allowed in config.get('allow', []) -%} {% for allowed in config.get('allow', []) -%}
allow {{ allowed }} allow {{ allowed }}
{% endfor %} {% endfor %}
{% endif %}
{%- endif %}


logdir {{ config.logdir }} logdir {{ config.logdir }}


{% for param in config.get('miscparams', []) -%}
{% for param in config.get('otherparams', []) -%}
{{ param }} {{ param }}
{% endfor %} {% endfor %}

+ 63
- 9
chrony/map.jinja Ver fichero

{% set chrony = salt['grains.filter_by']({ {% set chrony = salt['grains.filter_by']({
'Debian': { 'Debian': {
'package': 'chrony',
'service': 'chronyd',
'config': '/etc/chrony/chrony.conf',
'config_src': 'salt://chrony/files/chrony_config',
'package': 'chrony',
'service': 'chrony',
'config': '/etc/chrony/chrony.conf',
'config_src': 'salt://chrony/files/chrony_config',
'ntpservers': [
'0.debian.pool.ntp.org',
'1.debian.pool.ntp.org',
'2.debian.pool.ntp.org',
'3.debian.pool.ntp.org'
],
'options': 'offline minpoll 8',
'allow': [
'10/8',
'192.168/16',
'172.16/12'
],
'logdir': '/var/log/chrony',
'keyfile': '/etc/chrony/chrony.keys',
'driftfile': '/var/lib/chrony/chrony.drift',
'otherparams': [
'log tracking measurements statistics',
'maxupdateskew 100.0',
'dumponexit',
'dumpdir /var/lib/chrony',
'commandkey 1',
'local stratum 10',
'rtconutc'
],
}, },
'RedHat': { 'RedHat': {
'package': 'chrony',
'service': 'chronyd',
'config': '/etc/chrony.conf',
'config_src': 'salt://chrony/files/chrony_config',
'package': 'chrony',
'service': 'chronyd',
'config': '/etc/chrony.conf',
'config_src': 'salt://chrony/files/chrony_config',
'ntpservers': [
'0.centos.pool.ntp.org',
'1.centos.pool.ntp.org',
'2.centos.pool.ntp.org',
'3.centos.pool.ntp.org'
],
'options': 'iburst',
'logdir': '/var/log/chrony',
'keyfile': '/etc/chrony.keys',
'driftfile': '/var/lib/chrony/drift',
'otherparams': [
'rtcsync',
'makestep 10 3',
'stratumweight 0',
'bindcmdaddress 127.0.0.1',
'bindcmdaddress ::1',
'commandkey 1',
'generatecommandkey',
'noclientlog',
'logchange 0.5',
],
}, },
}, },
merge=salt['pillar.get']('chrony:config')) %}
grain='os_family',
merge=salt['pillar.get']('chrony:config'))
%}

{# Debian distros check /etc/default/rcS to determine UTC setting #}
{% if grains['os_family'] == "Debian" %}
{% if salt['cmd.run']('grep UTC=no /etc/default/rcS') %}
{% do chrony['otherparams'].remove('rtconutc') %}
{% endif %}
{% endif %}

Cargando…
Cancelar
Guardar