From 9ab3a65c0d23a3ce24d89089561158158e28392c Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Mon, 2 Mar 2015 10:48:01 -0600 Subject: [PATCH] Fixes #2: Add ability to stop munin cron job. --- README.md | 6 +++++- defaults/main.yml | 1 + tasks/main.yml | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4c0506e..a5c6ed7 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,14 @@ Some default locations for Munin-generated files, configurations, logs, etc. 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_cron_job: present + +Determines whether the munin cron job (which runs every 5 minutes) should be active. By setting this to `absent`, you can leave munin installed and configured on your server but effectively disable it. This allows quick enabling or disabling for munin monitoring. + 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. +These values will be used to generate a user via htpasswd under which the munin pages will be password protected with basic HTTP authentication. (*Note*: This method only works when Munin is running under default Apache configurations; if you use Nginx or a customized Apache server, you will need to configure authentication on your own). munin_hosts: - { diff --git a/defaults/main.yml b/defaults/main.yml index 1d5f15b..379b826 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -13,6 +13,7 @@ munin_rundir: /var/run/munin munin_includedir: /etc/munin/conf.d munin_html_strategy: cron +munin_cron_job: present munin_max_processes: 12 diff --git a/tasks/main.yml b/tasks/main.yml index ad2714c..d4ab9f2 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -28,3 +28,10 @@ password={{ munin_admin_password }} path=/etc/munin/munin-htpasswd state=present + +- name: Enable or disable the munin cron job. + lineinfile: + dest: /etc/cron.d/munin + state: "{{ munin_cron_job }}" + regexp: "^\\*/5 \\* \\* \\* \\*" + line: "*/5 * * * * munin test -x /usr/bin/munin-cron && /usr/bin/munin-cron"