Updated the Munin node config for FreeBSD

This commit is contained in:
Gregory Ballantine 2017-11-02 08:46:21 -04:00
parent 4c7d1d4f4e
commit 0e018836f3
4 changed files with 58 additions and 13 deletions

4
munin/defaults.yaml Normal file
View File

@ -0,0 +1,4 @@
munin:
file_user: root
file_group: root

View File

@ -1,4 +1,7 @@
{% set munin_master = salt['grains.filter_by']({
{## Start with defaults from defaults.sls ##}
{% import_yaml 'munin/defaults.yaml' as default_settings %}
{% set munin_master_settings = salt['grains.filter_by']({
'Debian': {
'package': 'munin',
'config': '/etc/munin/munin.conf',
@ -26,9 +29,19 @@
'config': '/etc/munin/munin.conf',
'config_src': 'salt://munin/files/munin.conf',
},
'FreeBSD': {
'package': 'munin-master',
'config': '/usr/local/etc/munin/munin.conf',
'config_src': 'salt://munin/files/munin.conf',
'file_group': 'wheel',
},
}, merge=salt['pillar.get']('munin:lookup:master')) %}
{% set munin_node = salt['grains.filter_by']({
{% set munin_master = default_settings.copy() %}
{% munin_master.update(munin_master_settings %}
{% set munin_node_settings = salt['grains.filter_by']({
'Debian': {
'package': 'munin-node',
'service': 'munin-node',
@ -64,9 +77,21 @@
'config_src': 'salt://munin/files/munin-node.conf',
'plugin_dir': '/usr/libexec/munin/plugins',
},
'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',
'file_group': 'wheel',
},
}, merge=salt['pillar.get']('munin:lookup:node')) %}
{% set net_ssleay = salt['grains.filter_by']({
{% set munin_node = default_settings.copy() %}
{% munin_node.update(munin_node_settings %}
{% set net_ssleay_settings = salt['grains.filter_by']({
'Debian': {
'package': 'libnet-ssleay-perl',
},
@ -76,9 +101,16 @@
'Gentoo': {
'package': 'dev-perl/Net-SSLeay',
},
'FreeBSD': {
'package': 'perl-Net-SSLeay',
},
}, merge=salt['pillar.get']('net_ssleay:lookup')) %}
{% set munin_tls = salt['grains.filter_by']({
{% set munin_ssleay = default_settings.copy() %}
{% munin_ssleay.update(munin_ssleay_settings %}
{% set munin_tls_settings = salt['grains.filter_by']({
'Debian': {
'private_key': '/etc/munin/tls/key.pem',
'certificate': '/etc/munin/tls/crt.pem',
@ -94,4 +126,13 @@
'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')) %}
{% set munin_tls = default_settings.copy() %}
{% munin_tls.update(munin_tls_settings %}

View File

@ -8,8 +8,8 @@ munin_node_config:
- name: {{ munin_node.config }}
- source: {{ munin_node.config_src }}
- template: jinja
- user: root
- group: root
- user: {{ munin_node.file_user }}
- group: {{ munin_node.file_group }}
- mode: 644
- watch_in:
- service: munin_node

View File

@ -5,11 +5,11 @@ include:
# Enable common plugins
{% for plugin, linked_file in pillar.get('munin_node_common_plugins', {}).items() %}
/etc/munin/plugins/{{ plugin }}:
{{ munin_node.plugin_dir }}/{{ plugin }}:
file.symlink:
- target: {{ munin_node.plugin_dir}}/{{ linked_file }}
- user: root
- group: root
- user: {{ munin_node.file_user }}
- group: {{ munin_node.file_group }}
- mode: 755
{% endfor %}
@ -17,11 +17,11 @@ include:
{% for hostname, plugin in salt['pillar.get']('munin_node_specific_plugins', {}).items() %}
{% if salt['pillar.get']('munin_node:host_name') == hostname %}
{% for plugin_name, linked_file in plugin.items() %}
/etc/munin/plugins/{{ plugin_name }}:
{{ munin_node.plugin_dir }}/{{ plugin_name }}:
file.symlink:
- target: {{ munin_node.plugin_dir}}/{{ linked_file }}
- user: root
- group: root
- user: {{ munin_node.file_user }}
- group: {{ munin_node.file_group }}
- mode: 755
{% endfor %}
{% endif %}
@ -30,4 +30,4 @@ include:
{{ munin_node.service }}:
service.running:
- watch:
- file: /etc/munin/plugins/*
- file: {{ munin_node.plugin_dir }}/*