Skip to content

Instantly share code, notes, and snippets.

@mattsouth
Last active February 6, 2017 12:07
Show Gist options
  • Save mattsouth/001228b74744fffa9d95705913cfcf0c to your computer and use it in GitHub Desktop.
Save mattsouth/001228b74744fffa9d95705913cfcf0c to your computer and use it in GitHub Desktop.
---
# file: munin-monitoring.yml
# install munin master that monitors itself on ubuntu 14.04
# and uses apache and fast-cgi (for the dynamic zooming graphs)
# to host dashboard
- hosts: monitoring
handlers:
- name: restart munin-node
service: name=munin-node state=restarted
- name: restart apache2
service: name=apache2 state=restarted
tasks:
- name: install monitoring packages
apt: pkg={{ item }} state=installed
with_items:
- apache2
- apache2-utils
- libcgi-fast-perl
- libapache2-mod-fcgid
- munin
- name: update munin conf
lineinfile:
dest=/etc/munin/munin.conf
regexp="\[localhost.localdomain\]"
line="[{{ ansible_hostname }}]"
backup=yes
notify:
- restart munin-node
# TODO: use a different strategy for updating apache.conf
- name: update apache conf - part 1
lineinfile:
dest=/etc/munin/apache.conf
regexp="#\s+Allow from localhost 127.0.0.0/8 ::1"
state=absent
backup=yes
- name: update apache conf - part 2
lineinfile:
dest=/etc/munin/apache.conf
regexp="\s+Order allow,deny"
state=absent
- name: update apache conf - part 3
lineinfile:
dest=/etc/munin/apache.conf
regexp="\s+Options None"
state=absent
- name: update apache conf - part 4
replace:
dest=/etc/munin/apache.conf
regexp="\s+Allow from localhost 127.0.0.0/8 ::1"
replace="\n\tRequire all granted\n\tOptions FollowSymLinks SymLinksIfOwnerMatch"
backup=yes
notify:
- restart apache2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment