successful munin master config creation based on pillar data

This commit is contained in:
Kenny Do 2014-01-05 01:04:43 -08:00
parent f6e5dfb11a
commit acc98d43df
3 changed files with 55 additions and 8 deletions

View File

@ -0,0 +1,35 @@
{% set config = pillar.get('munin_master', {}) -%}
{% set globals = config.get('globals', {}) -%}
{% set hosts = config.get('hosts', {}) -%}
{% set groups = config.get('groups', {}) -%}
#
# This config file is managed by salt.
#
{%- macro print_directive(directive, value) -%}
{%- if value is sameas true -%}
{{ directive }} yes
{%- elif value is sameas false %}
{{ directive }} no
{%- else -%}
{{ directive }} {{ value }}
{%- endif -%}
{%- endmacro %}
{% for directive, value in globals.iteritems() -%}
{{ print_directive(directive, value) }}
{% endfor %}
{%- for host, directives in hosts.iteritems() %}
[{{ host }}]
{%- for directive, value in directives.iteritems() %}
{{ print_directive(directive, value) }}
{%- endfor %}
{% endfor %}
{%- for group, directives in groups.iteritems() %}
[{{ group }}]
{%- for directive, value in directives.iteritems() %}
{{ print_directive(directive, value) }}
{%- endfor %}
{% endfor %}

View File

@ -0,0 +1,11 @@
{% from "munin/map.jinja" import munin_master with context %}
include:
- munin.master
munin_master_config:
file.managed:
- name: {{ munin_master.config }}
- source: {{ munin_master.config_src }}
- template: jinja

View File

@ -1,13 +1,14 @@
munin_master: munin_master:
globals:
dbdir: "/var/lib/munin" dbdir: "/var/lib/munin"
htmldir: "/var/cache/munin/www" htmldir: "/var/cache/munin/www"
logdir: "/var/log/munin" logdir: "/var/log/munin"
rundir: "/var/run/munin" rundir: "/var/run/munin"
includerdir: "/etc/munin/munin-conf.d" includedir: "/etc/munin/munin-conf.d"
hosts: hosts:
- "localhost.localdomain": "localhost.localdomain":
- address: "127.0.0.1" address: "127.0.0.1"
- use_node_name: yes use_node_name: "yes"
munin_node: munin_node:
log_level: 4 log_level: 4