Added a defaults.yaml file to clean up the map.jinja file a little bit
This commit is contained in:
parent
e3b499516e
commit
b2f661cdb8
22
munin/defaults.yaml
Normal file
22
munin/defaults.yaml
Normal file
@ -0,0 +1,22 @@
|
||||
munin_master:
|
||||
package: munin
|
||||
config: /etc/munin/munin.conf
|
||||
config_src: salt://munin/files/munin.conf
|
||||
file_user: root
|
||||
file_group: root
|
||||
|
||||
munin_node:
|
||||
package: munin-node
|
||||
service: munin-node
|
||||
config: /etc/munin/munin-node.conf
|
||||
config_src: salt://munin/files/munin-node.conf
|
||||
plugin_dir: /etc/munin/plugins
|
||||
plugin_target_dir: /usr/share/munin/plugins
|
||||
file_user: root
|
||||
file_group: root
|
||||
|
||||
munin_tls:
|
||||
private_key: /etc/munin/tls/key.pem
|
||||
certificate: /etc/munin/tls/crt.pem
|
||||
ca_certificate: /etc/munin/tls/cacrt.pem
|
||||
|
122
munin/map.jinja
122
munin/map.jinja
@ -1,112 +1,40 @@
|
||||
{% set munin_master = salt['grains.filter_by']({
|
||||
'Debian': {
|
||||
'package': 'munin',
|
||||
'config': '/etc/munin/munin.conf',
|
||||
'config_src': 'salt://munin/files/munin.conf',
|
||||
'file_user': 'root',
|
||||
'file_group': 'root',
|
||||
},
|
||||
'RedHat': {
|
||||
'package': 'munin',
|
||||
'config': '/etc/munin/munin.conf',
|
||||
'config_src': 'salt://munin/files/munin.conf',
|
||||
'file_user': 'root',
|
||||
'file_group': 'root',
|
||||
},
|
||||
'Suse': {
|
||||
'package': 'munin',
|
||||
'config': '/etc/munin/munin.conf',
|
||||
'config_src': 'salt://munin/files/munin.conf',
|
||||
'file_user': 'root',
|
||||
'file_group': 'root',
|
||||
},
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=jinja
|
||||
|
||||
{## Start with default values from defaults.yaml ##}
|
||||
{% import_yaml 'munin/defaults.yaml' as default_settings %}
|
||||
|
||||
{## Set OS-specific values for each of the states ##}
|
||||
{% set munin_master_osmap = salt['grains.filter_by']({
|
||||
'Arch': {
|
||||
'package': 'munin',
|
||||
'config': '/etc/munin/munin.conf',
|
||||
'config_src': 'salt://munin/files/munin.conf',
|
||||
'cron_service': '/etc/systemd/system/munin-cron.service',
|
||||
'cron_timer': '/etc/systemd/system/munin-cron.timer',
|
||||
'file_user': 'root',
|
||||
'file_group': 'root',
|
||||
},
|
||||
'Gentoo': {
|
||||
'package': 'net-analyzer/munin',
|
||||
'config': '/etc/munin/munin.conf',
|
||||
'config_src': 'salt://munin/files/munin.conf',
|
||||
'file_user': 'root',
|
||||
'file_group': 'root',
|
||||
},
|
||||
'FreeBSD': {
|
||||
'package': 'munin-master',
|
||||
'config': '/usr/local/etc/munin/munin.conf',
|
||||
'config_src': 'salt://munin/files/munin.conf',
|
||||
'file_user': 'root',
|
||||
'file_group': 'wheel',
|
||||
},
|
||||
}, merge=salt['pillar.get']('munin:lookup:master')) %}
|
||||
}, grain='os_family') %}
|
||||
|
||||
{% set munin_node = salt['grains.filter_by']({
|
||||
'Debian': {
|
||||
'package': 'munin-node',
|
||||
'service': 'munin-node',
|
||||
'config': '/etc/munin/munin-node.conf',
|
||||
'config_src': 'salt://munin/files/munin-node.conf',
|
||||
'plugin_dir': '/etc/munin/plugins',
|
||||
'plugin_target_dir': '/usr/share/munin/plugins',
|
||||
'file_user': 'root',
|
||||
'file_group': 'root',
|
||||
},
|
||||
'RedHat': {
|
||||
'package': 'munin-node',
|
||||
'service': 'munin-node',
|
||||
'config': '/etc/munin/munin-node.conf',
|
||||
'config_src': 'salt://munin/files/munin-node.conf',
|
||||
'plugin_dir': '/etc/munin/plugins',
|
||||
'plugin_target_dir': '/usr/share/munin/plugins',
|
||||
'file_user': 'root',
|
||||
'file_group': 'root',
|
||||
},
|
||||
'Suse': {
|
||||
'package': 'munin-node',
|
||||
'service': 'munin-node',
|
||||
'config': '/etc/munin/munin-node.conf',
|
||||
'config_src': 'salt://munin/files/munin-node.conf',
|
||||
'plugin_dir': '/etc/munin/plugins',
|
||||
'plugin_target_dir': '/usr/share/munin/plugins',
|
||||
'file_user': 'root',
|
||||
'file_group': 'root',
|
||||
},
|
||||
'Arch': {
|
||||
'package': 'munin-node',
|
||||
'service': 'munin-node',
|
||||
'config': '/etc/munin/munin-node.conf',
|
||||
'config_src': 'salt://munin/files/munin-node.conf',
|
||||
'plugin_dir': '/etc/munin/plugins',
|
||||
'plugin_target_dir': '/usr/lib/munin/plugins',
|
||||
'file_user': 'root',
|
||||
'file_group': 'root',
|
||||
},
|
||||
'Gentoo': {
|
||||
'package': 'net-analyzer/munin',
|
||||
'service': 'munin-node',
|
||||
'config': '/etc/munin/munin-node.conf',
|
||||
'config_src': 'salt://munin/files/munin-node.conf',
|
||||
'plugin_dir': '/etc/munin/plugins',
|
||||
'plugin_target_dir': '/usr/libexec/munin/plugins',
|
||||
'file_user': 'root',
|
||||
'file_group': 'root',
|
||||
},
|
||||
'FreeBSD': {
|
||||
'package': 'munin-node',
|
||||
'service': 'munin-node',
|
||||
'config': '/usr/local/etc/munin/munin-node.conf',
|
||||
'config_src': 'salt://munin/files/munin-node.conf',
|
||||
'plugin_dir': '/usr/local/etc/munin/plugins',
|
||||
'plugin_target_dir': '/usr/local/share/munin/plugins',
|
||||
'file_user': 'root',
|
||||
'file_group': 'wheel',
|
||||
},
|
||||
}, merge=salt['pillar.get']('munin:lookup:node')) %}
|
||||
}, grain='os_family') %}
|
||||
|
||||
{% set net_ssleay = salt['grains.filter_by']({
|
||||
'Debian': {
|
||||
@ -121,27 +49,23 @@
|
||||
'FreeBSD': {
|
||||
'package': 'perl-Net-SSLeay',
|
||||
},
|
||||
}, merge=salt['pillar.get']('net_ssleay:lookup')) %}
|
||||
}, grain='os_family') %}
|
||||
|
||||
{% set munin_tls = salt['grains.filter_by']({
|
||||
'Debian': {
|
||||
'private_key': '/etc/munin/tls/key.pem',
|
||||
'certificate': '/etc/munin/tls/crt.pem',
|
||||
'ca_certificate': '/etc/munin/tls/cacert.pem',
|
||||
},
|
||||
'RedHat': {
|
||||
'private_key': '/etc/munin/tls/key.pem',
|
||||
'certificate': '/etc/munin/tls/crt.pem',
|
||||
'ca_certificate': '/etc/munin/tls/cacert.pem',
|
||||
},
|
||||
'Gentoo': {
|
||||
'private_key': '/etc/munin/tls/key.pem',
|
||||
'certificate': '/etc/munin/tls/crt.pem',
|
||||
'ca_certificate': '/etc/munin/tls/cacert.pem',
|
||||
},
|
||||
'FreeBSD': {
|
||||
'private_key': '/usr/local/etc/munin/tls/key.pem',
|
||||
'certificate': '/usr/local/etc/munin/tls/crt.pem',
|
||||
'ca_certificate': '/usr/local/etc/munin/tls/cacert.pem',
|
||||
},
|
||||
}, merge=salt['pillar.get']('munin:lookup:tls')) %}
|
||||
}, grain='os_family') %}
|
||||
|
||||
{## Merge osmaps into defaults, then marge in pillar ##}
|
||||
{% do default_settings.munin_master.update(munin_master_osmap) %}
|
||||
{% set munin_master = salt['pillar.get']('munin:lookup:munin_master') %}
|
||||
{% do default_settings.munin_node.update(munin_node_osmap) %}
|
||||
{% set munin_node = salt['pillar.get']('munin:lookup:munin_node') %}
|
||||
{% do default_settings.munin_ssleay.update(munin_ssleay_osmap) %}
|
||||
{% set munin_ssleay = salt['pillar.get']('munin:lookup:munin_ssleay') %}
|
||||
{% do default_settings.munin_tls.update(munin_tls_osmap) %}
|
||||
{% set munin_tls = salt['pillar.get']('munin:lookup:munin_tls') %}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user