Updates to get role working correctly under Debian/Ubuntu.

master
Jeff Geerling 2014-05-11 22:32:24 -05:00
parent 295355d31d
commit f9133deec4
7 changed files with 71 additions and 14 deletions

View File

@ -2,23 +2,54 @@
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-munin.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-munin)
Installs munin, a monitoring system, on RedHat/CentOS.
Installs munin, a monitoring system, on RedHat/CentOS or Debian/Ubuntu Linux servers.
## Requirements
None.
If you are running a RedHat-based distribution, you need to install the EPEL repository, which can be simply installed via the `geerlingguy.repo-epel` role.
If you would like to view munin's graphs and output via HTTP, you will need an HTTP server like Apache or Nginx running.
## Role Variables
Available variables are listed below, along with default values (see `vars/main.yml`):
TODO
munin_dbdir: /var/lib/munin
munin_htmldir: /var/www/html/munin
munin_logdir: /var/log/munin
munin_rundir: /var/run/munin
munin_includedir: /etc/munin/conf.d
Some default locations for Munin-generated files, configurations, logs, etc.
munin_html_strategy: cron
munin_max_processes: 12
See the official Munin documentation for [munin.conf](http://munin.readthedocs.org/en/latest/reference/munin.conf.html) for more information on these and other optional directives.
munin_admin_user: munin
munin_admin_password: munin
These values will be used to generate a user via htpasswd under which the munin pages will be password protected with basic HTTP authentication.
munin_hosts:
- {
name: "localhost",
address: "127.0.0.1",
extra: ["use_node_name yes"]
}
A listing of hosts to which munin will connect and monitor. Each item in the list will be added to your munin configuration like the following (assuming you're using the above example):
[localhost]
address: 127.0.0.1
use_node_name yes
See documentation for [Munin Node Definitions](http://munin.readthedocs.org/en/latest/reference/munin.conf.html#node-definitions) for more details as to what values to use here.
## Dependencies
- geerlingguy.repo-epel
Additionally, if you'd like to view the graphs via HTTP, you will need a server like Apache or Nginx running, to serve the munin-generated HTML and graphs.
None.
## Example Playbook

View File

@ -1,9 +1,17 @@
---
munin_packages:
- python-passlib
- munin
munin_conf_d_directory: /etc/munin/conf.d
munin_dbdir: /var/lib/munin
munin_htmldir: /var/www/html/munin
munin_logdir: /var/log/munin
munin_rundir: /var/run/munin
munin_includedir: /etc/munin/conf.d
munin_html_strategy: cron
munin_max_processes: 12

View File

@ -1,6 +1,5 @@
---
dependencies:
- { role: geerlingguy.repo-epel }
dependencies: []
galaxy_info:
author: geerlingguy

View File

@ -1,9 +1,16 @@
---
- name: Ensure python-passlib is installed (RedHat).
yum: pkg=python-passlib state=installed
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"
- name: Ensure munin is installed (RedHat).
yum: pkg=munin state=installed
- name: Install required packages for munin (RedHat).
yum: "pkg={{ item }} state=installed"
with_items: munin_packages
when: ansible_os_family == 'RedHat'
- name: Install required packages for munin (Debian).
apt: "pkg={{ item }} state=installed"
with_items: munin_packages
when: ansible_os_family == 'Debian'
- name: Copy munin configurations.
template: >
@ -12,7 +19,7 @@
owner=root group=root mode=644
with_items:
- { src: munin.conf.j2, dest: /etc/munin/munin.conf }
- { src: hosts.conf.j2, dest: /etc/munin/conf.d/hosts.conf }
- { src: hosts.conf.j2, dest: "{{ munin_conf_d_directory }}/hosts.conf" }
- name: Create munin user via htpasswd.
htpasswd: >

View File

@ -18,7 +18,7 @@ tmpldir /etc/munin/templates
# cgitmpdir @@CGITMPDIR@@
# (Exactly one) directory to include all files from.
includedir /etc/munin/conf.d
includedir {{ munin_includedir }}
# You can choose the time reference for "DERIVE" like graphs, and show
# "per minute", "per hour" values instead of the default "per second"

6
vars/Debian.yml Normal file
View File

@ -0,0 +1,6 @@
---
munin_conf_d_directory: /etc/munin/munin-conf.d
munin_htmldir: /var/cache/munin/www
munin_includedir: /etc/munin/munin-conf.d

6
vars/RedHat.yml Normal file
View File

@ -0,0 +1,6 @@
---
munin_conf_d_directory: /etc/munin/conf.d
munin_htmldir: /var/www/html/munin
munin_includedir: /etc/munin/conf.d