Przeglądaj źródła

Merge pull request #5 from noelmcloughlin/add-defaults-osmap-yaml

Add osmapping,defaults for modular parms
tags/v0.2.0
Niels Abspoel 7 lat temu
rodzic
commit
0bde1362a0
3 zmienionych plików z 98 dodań i 87 usunięć
  1. +27
    -0
      chrony/defaults.yaml
  2. +19
    -87
      chrony/map.jinja
  3. +52
    -0
      chrony/osmap.yaml

+ 27
- 0
chrony/defaults.yaml Wyświetl plik

@@ -0,0 +1,27 @@
# Default lookup dictionary

chrony:
package: chrony
service: chronyd
config: /etc/chrony.conf
config_src: salt://chrony/files/chrony_config
ntpservers: [ '0.us.pool.ntp.org',
'1.us.pool.ntp.org',
'2.us.pool.ntp.org',
'3.us.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',
]
allow: [ '10/8', '192.168/16', '172.16/12' ]

+ 19
- 87
chrony/map.jinja Wyświetl plik

@@ -1,88 +1,20 @@
{% set chrony = salt['grains.filter_by']({
'Debian': {
'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': {
'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',
],
},
'Arch': {
'package': 'chrony',
'service': 'chronyd',
'config': '/etc/chrony.conf',
'config_src': 'salt://chrony/files/chrony_config',
'ntpservers': [
'0.arch.pool.ntp.org',
'1.arch.pool.ntp.org',
'2.arch.pool.ntp.org'
],
'options': 'iburst',
'logdir': '/var/log/chrony',
'keyfile': '/etc/chrony.keys',
'driftfile': '/var/lib/chrony/drift',
'otherparams': [
'rtconutc',
'rtcsync',
],
}
},
grain='os_family',
merge=salt['pillar.get']('chrony:config'))
%}
{## start with defaults from defaults.yaml ##}
{% import_yaml "chrony/defaults.yaml" as defaults %}
{% import_yaml "chrony/osmap.yaml" as osmap %}

{# 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 %}
{% set chrony = salt['grains.filter_by'](
defaults,
merge=salt['grains.filter_by'](
osmap,
grain='os_family',
merge=salt['pillar.get']('chrony', {}),
),
base='chrony'
) %}

-{# 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 %}

+ 52
- 0
chrony/osmap.yaml Wyświetl plik

@@ -0,0 +1,52 @@
# OS parameters overriding common defaults(.yaml)

Debian:
service: chrony
config: /etc/chrony/chrony.conf
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
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:
ntpservers: [ '0.centos.pool.ntp.org',
'1.centos.pool.ntp.org',
'2.centos.pool.ntp.org',
'3.centos.pool.ntp.org', ]
otherparams: [ 'rtcsync',
'makestep 10 3',
'stratumweight 0',
'bindcmdaddress 127.0.0.1',
'bindcmdaddress ::1',
'commandkey 1',
'generatecommandkey',
'noclientlog',
'logchange 0.5', ]

Arch:
ntpservers: [ '0.arch.pool.ntp.org',
'1.arch.pool.ntp.org',
'2.arch.pool.ntp.org' ]
otherparams: [ 'rtconutc',
'rtcsync', ]

Suse:
ntpservers: [ '0.arch.opensuse.ntp.org',
'1.arch.opensuse.ntp.org',
'2.arch.opensuse.ntp.org',
'3.opensuse.pool.ntp.org', ]
otherparams: [ 'rtcsync',
'makestep 10 3',
'maxdistance 6',
'logchange 0.1', ]


Ładowanie…
Anuluj
Zapisz