Compare commits

..

No commits in common. "master" and "style-short-dec" have entirely different histories.

13 changed files with 57 additions and 243 deletions

View File

@ -27,13 +27,6 @@ Includes ``munin.master``.
Generates a config file for the munin master based on pillar data.
``munin.master.munin-cron``
-----------------------
Includes ``munin.master``.
Archlinux only. Enable munin-cron via a systemd timer.
``munin.node``
--------------
@ -46,13 +39,6 @@ Includes ``munin.node``.
Generates a config file for the munin node based on pillar data.
``munin.node.plugins``
----------------------
Includes ``munin.node``.
Symlinks the desired plugins on the munin node based on pillar data.
``munin.tls``
-------------

View File

@ -1,25 +0,0 @@
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
net_ssleay:
package: perl-Net-SSLeay
munin_tls:
private_key: /etc/munin/tls/key.pem
certificate: /etc/munin/tls/crt.pem
ca_certificate: /etc/munin/tls/cacrt.pem

View File

@ -1,7 +0,0 @@
[Unit]
Description=Munin Cron
After=network.target
[Service]
User=munin
ExecStart=/usr/bin/munin-cron

View File

@ -1,8 +0,0 @@
[Unit]
Description=Munin Cron Timer
[Timer]
OnCalendar=*-*-* *:00/5:00
[Install]
WantedBy=multi-user.target

View File

@ -3,7 +3,7 @@
# This config file is managed by salt.
#
{%- for directive, value in config|dictsort %}
{%- for directive, value in config.iteritems() %}
{%- if value is string or value is number %}
{{ directive }} {{ value }}
{%- else %}

View File

@ -16,24 +16,20 @@
{%- endif -%}
{%- endmacro %}
{% for directive, value in globals|dictsort -%}
{% for directive, value in globals.iteritems() -%}
{{ print_directive(directive, value) }}
{% endfor %}
{%- for host, directives in hosts|dictsort %}
{%- for host, directives in hosts.iteritems() %}
[{{ host }}]
{%- for directive, value in directives|dictsort %}
{%- for directive, value in directives.iteritems() %}
{{ print_directive(directive, value) }}
{%- endfor %}
{% endfor %}
{%- for group, directives in groups|dictsort %}
{%- for group, directives in groups.iteritems() %}
[{{ group }}]
{%- for directive, value in directives|dictsort %}
{%- for directive, value in directives.iteritems() %}
{{ print_directive(directive, value) }}
{%- endfor %}
{% endfor %}
{%- if config.get('formula_append') %}
{{ config.formula_append }}
{% endif %}

View File

@ -1,73 +1,49 @@
# -*- coding: utf-8 -*-
# vim: ft=jinja
{% set munin_master = salt['grains.filter_by']({
'Debian': {
'package': 'munin',
'config': '/etc/munin/munin.conf',
'config_src': 'salt://munin/files/munin.conf',
},
'RedHat': {
'package': 'munin',
'config': '/etc/munin/munin.conf',
'config_src': 'salt://munin/files/munin.conf',
},
}, merge=salt['pillar.get']('munin_master:lookup')) %}
{## Start with default values from defaults.yaml ##}
{% import_yaml 'munin/defaults.yaml' as default_settings %}
{% 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',
},
'RedHat': {
'package': 'munin-node',
'service': 'munin-node',
'config': '/etc/munin/munin-node.conf',
'config_src': 'salt://munin/files/munin-node.conf',
},
}, merge=salt['pillar.get']('munin_node:lookup')) %}
{## Set OS-specific values for each of the states ##}
{% set munin_master = salt['grains.filter_by'](
default_settings,
base='munin_master',
merge=salt['grains.filter_by']({
'Arch': {
'cron_service': '/etc/systemd/system/munin-cron.service',
'cron_timer': '/etc/systemd/system/munin-cron.timer',
},
'Gentoo': {
'package': 'net-analyzer/munin',
},
'FreeBSD': {
'package': 'munin-master',
'config': '/usr/local/etc/munin/munin.conf',
'file_group': 'wheel',
},
}, grain='os_family', merge=salt['pillar.get']('munin:lookup:munin_master', {})),
) %}
{% set net_ssleay = salt['grains.filter_by']({
'Debian': {
'package': 'libnet-ssleay-perl',
},
'RedHat': {
'package': 'perl-Net-SSLeay',
},
}, merge=salt['pillar.get']('net_ssleay:lookup')) %}
{% set munin_node = salt['grains.filter_by'](
default_settings,
base='munin_node',
merge=salt['grains.filter_by']({
'Arch': {
'plugin_target_dir': '/usr/lib/munin/plugins',
},
'Gentoo': {
'package': 'net-analyzer/munin',
'plugin_target_dir': '/usr/libexec/munin/plugins',
},
'FreeBSD': {
'config': '/usr/local/etc/munin/munin-node.conf',
'plugin_dir': '/usr/local/etc/munin/plugins',
'plugin_target_dir': '/usr/local/share/munin/plugins',
'file_group': 'wheel',
},
}, grain='os_family', merge=salt['pillar.get']('munin:lookup:munin_node', {})),
) %}
{% set net_ssleay = salt['grains.filter_by'](
default_settings,
base='net_ssleay',
merge=salt['grains.filter_by']({
'Debian': {
'package': 'libnet-ssleay-perl',
},
'Arch': {
'package': 'perl-net-ssleay',
},
'Gentoo': {
'package': 'dev-perl/Net-SSLeay',
},
}, grain='os_family', merge=salt['pillar.get']('munin:lookup:net_ssleay', {})),
) %}
{% set munin_tls = salt['grains.filter_by'](
default_settings,
base='munin_tls',
merge=salt['grains.filter_by']({
'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',
},
}, grain='os_family', merge=salt['pillar.get']('munin:lookup:munin_tls', {})),
) %}
{% 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',
},
}, merge=salt['pillar.get']('munin_tls:lookup')) %}

View File

@ -8,7 +8,7 @@ munin_master_config:
- name: {{ munin_master.config }}
- source: {{ munin_master.config_src }}
- template: jinja
- user: {{ munin_master.file_user }}
- group: {{ munin_master.file_group }}
- user: root
- group: root
- mode: 644

View File

@ -1,36 +0,0 @@
{% from "munin/map.jinja" import munin_master with context %}
include:
- munin.master
{% if salt['grains.get']('os_family') == 'Arch' %}
cron_service:
file.managed:
- name: {{ munin_master.cron_service }}
- source: salt://munin/files/Arch/munin-cron.service
- user: {{ munin_master.file_user }}
- group: {{ munin_master.file_group }}
- mode: 644
cron_timer:
file.managed:
- name: {{ munin_master.cron_timer }}
- source: salt://munin/files/Arch/munin-cron.timer
- user: {{ munin_master.file_user }}
- group: {{ munin_master.file_group }}
- mode: 644
munin-cron.timer:
service.running:
- enable: True
- watch:
- file: cron_service
- file: cron_timer
{% endif %}
{% if salt['grains.get']('os_family') == 'Suse' %}
munin-cron:
service.running:
- name: cron
- enable: True
{% endif %}

View File

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

View File

@ -1,33 +0,0 @@
{% from "munin/map.jinja" import munin_node with context %}
include:
- munin.node
# Enable common plugins
{% for plugin, linked_file in pillar.get('munin_node_common_plugins', {}).items() %}
{{ munin_node.plugin_dir }}/{{ plugin }}:
file.symlink:
- target: {{ munin_node.plugin_target_dir}}/{{ linked_file }}
- user: {{ munin_node.file_user }}
- group: {{ munin_node.file_group }}
- mode: 755
{% endfor %}
# Node specific plugins
{% 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() %}
{{ munin_node.plugin_dir }}/{{ plugin_name }}:
file.symlink:
- target: {{ munin_node.plugin_target_dir}}/{{ linked_file }}
- user: {{ munin_node.file_user }}
- group: {{ munin_node.file_group }}
- mode: 755
{% endfor %}
{% endif %}
{% endfor %}
{{ munin_node.service }}:
service.running:
- watch:
- file: {{ munin_node.plugin_dir }}/*

View File

@ -12,8 +12,6 @@ munin_tls_private_key:
- group: munin
- mode: 600
- contents_pillar: munin_tls:private_pem
- makedirs: True
- dir_mode: 700
{%- endif %}
{%- if salt['pillar.get']('munin_tls:certificate_pem') %}
@ -24,8 +22,6 @@ munin_tls_certificate:
- group: munin
- mode: 600
- contents_pillar: munin_tls:certificate_pem
- makedirs: True
- dir_mode: 700
{%- endif %}
{%- if salt['pillar.get']('munin_tls:ca_certificate_pem') %}
@ -36,6 +32,4 @@ munin_tls_ca_certificate:
- group: munin
- mode: 600
- contents_pillar: munin_tls:ca_certificate_pem
- makedirs: True
- dir_mode: 700
{%- endif %}

View File

@ -1,13 +1,3 @@
# Only enable and change or add lookup data when you need to change the defaults!
#munin:
# lookup:
# master:
# config_src: 'salt://munin/files/my-munin.conf',
# node:
# config_src: 'salt://munin/files/my-munin-node.conf',
# tls:
# private_key: '/etc/ssl/private/munin/key.pem'
munin_master:
globals:
dbdir: "/var/lib/munin"
@ -18,10 +8,7 @@ munin_master:
hosts:
"localhost.localdomain":
address: "127.0.0.1"
use_node_name: "no"
# In case you need additional variables
formula_append: |
some_variable value
use_node_name: "yes"
munin_node:
log_level: 4
@ -39,7 +26,6 @@ munin_node:
- "\\.dpkg-(tmp|new|old|dist)$"
- "\\.rpm(save|new)$"
- "\\.pod$"
host_name: {{ grains['host'] }}
allow:
- "^127\\.0\\.0\\.1$"
- "^::1$"
@ -59,18 +45,3 @@ munin_tls:
-----BEGIN CERTIFICATE-----
Inline CA certificate key
-----END CERTIFICATE-----
munin_node_common_plugins:
cpu: cpu
df: df
memory: memory
uptime: uptime
users: users
load: load
if_eth0: if_
munin_node_specific_plugins:
example_server_01:
cpuspeed: cpuspeed
example_server_02:
irqstats: irqstats