aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ansible/host_vars/lovelace/munin.yml25
-rw-r--r--ansible/playbook.yml1
-rw-r--r--ansible/roles/munin-node/defaults/main.yml3
-rw-r--r--ansible/roles/munin-node/handlers/main.yml (renamed from ansible/roles/munin/handlers/main.yml)2
-rw-r--r--ansible/roles/munin-node/tasks/main.yml74
-rw-r--r--ansible/roles/munin-node/templates/munin-node.conf.j2 (renamed from ansible/roles/munin/templates/munin-node.conf.j2)0
-rw-r--r--ansible/roles/munin-node/templates/plugin.conf.j2 (renamed from ansible/roles/munin/templates/plugin.conf.j2)0
-rw-r--r--ansible/roles/munin-node/templates/plugins/ldap01/.gitkeep0
-rw-r--r--ansible/roles/munin-node/templates/plugins/lovelace/dovecot_maildirs.sh.j2 (renamed from ansible/roles/munin/templates/plugins/dovecot_maildirs.sh.j2)0
-rw-r--r--ansible/roles/munin-node/templates/plugins/lovelace/lovering_inheritance.py.j2 (renamed from ansible/roles/munin/templates/plugins/lovering_inheritance.py.j2)0
-rw-r--r--ansible/roles/munin/tasks/main.yml90
11 files changed, 105 insertions, 90 deletions
diff --git a/ansible/host_vars/lovelace/munin.yml b/ansible/host_vars/lovelace/munin.yml
new file mode 100644
index 0000000..bd7912e
--- /dev/null
+++ b/ansible/host_vars/lovelace/munin.yml
@@ -0,0 +1,25 @@
+---
+munin_node__plugins:
+ # SpamAssassin
+ - src: spamstats
+ # Nginx
+ - src: nginx_request
+ - src: nginx_status
+ # Postfix
+ - src: postfix_mailstats
+ - src: postfix_mailqueue
+ - src: postfix_mailvolume
+ # PostgreSQL
+ - src: postgres_size_
+ dest: postgres_size_metricity
+ - src: postgres_size_
+ dest: postgres_size_site
+ - src: postgres_size_
+ dest: postgres_size_ALL
+ - src: postgres_xlog
+ - src: postgres_autovacuum
+ - src: postgres_bgwriter
+ - src: postgres_checkpoints
+ - src: postgres_connections_db
+ - src: postgres_users
+ - src: postgres_xlog
diff --git a/ansible/playbook.yml b/ansible/playbook.yml
index fb0bf6a..643e4b3 100644
--- a/ansible/playbook.yml
+++ b/ansible/playbook.yml
@@ -4,6 +4,7 @@
- common
- pydis-mtls
- wireguard
+ - munin-node
- name: Deploy services to Netcup nodes
hosts: netcup
diff --git a/ansible/roles/munin-node/defaults/main.yml b/ansible/roles/munin-node/defaults/main.yml
new file mode 100644
index 0000000..60e2230
--- /dev/null
+++ b/ansible/roles/munin-node/defaults/main.yml
@@ -0,0 +1,3 @@
+---
+munin_node__plugin_packages: "{{ ('databases' in group_names) | ternary(['libdbd-pg-perl'], []) }}"
+munin_node__plugins: []
diff --git a/ansible/roles/munin/handlers/main.yml b/ansible/roles/munin-node/handlers/main.yml
index 68ffcdd..cf8e23d 100644
--- a/ansible/roles/munin/handlers/main.yml
+++ b/ansible/roles/munin-node/handlers/main.yml
@@ -3,3 +3,5 @@
service:
name: munin-node
state: restarted
+ tags:
+ - role::munin-node
diff --git a/ansible/roles/munin-node/tasks/main.yml b/ansible/roles/munin-node/tasks/main.yml
new file mode 100644
index 0000000..9c9026e
--- /dev/null
+++ b/ansible/roles/munin-node/tasks/main.yml
@@ -0,0 +1,74 @@
+---
+- name: Install munin-node & plugin packages
+ package:
+ name: "{{ ['munin-node'] + munin_node__plugin_packages }}"
+ state: present
+ tags:
+ - role::munin-node
+
+- name: Template munin-node configuration file
+ template:
+ src: munin-node.conf.j2
+ dest: /etc/munin/munin-node.conf
+ owner: root
+ group: root
+ mode: "0444"
+ tags:
+ - role::munin-node
+ notify:
+ - Restart munin-node service
+
+- name: Template munin plugin configuration file
+ template:
+ src: plugin.conf.j2
+ dest: /etc/munin/plugin-conf.d/custom
+ owner: root
+ group: root
+ mode: "0444"
+ tags:
+ - role::munin-node
+ notify:
+ - Restart munin-node service
+
+- name: Enable non-default munin plugins
+ file:
+ src: "/usr/share/munin/plugins/{{ item.src }}"
+ dest: "/etc/munin/plugins/{{ item.dest | default(item.src) }}"
+ state: link
+ loop: "{{ munin_node__plugins }}"
+ tags:
+ - role::munin-node
+ notify:
+ - Restart munin-node service
+
+- name: Copy custom munin plugins
+ template:
+ src: "{{ item }}"
+ # Split two levels of file extensions
+ dest: "/etc/munin/plugins/{{ item | basename | splitext | first | splitext | first }}"
+ owner: root
+ group: root
+ mode: "0555"
+ loop_control:
+ # I love representing data modification logic in YAML!
+ label: "{{ item | basename | splitext | first | splitext | first }}"
+ with_fileglob: "../templates/plugins/{{ ansible_hostname }}/*"
+ tags:
+ - role::munin-node
+
+- name: Disable some unneeded plugins
+ file:
+ path: "/etc/munin/plugins/{{ item }}"
+ state: absent
+ loop:
+ - squeezebox_albums
+ - squeezebox_artists
+ - squeezebox_genres
+ - squeezebox_signalstrength
+ - squeezebox_songs
+ - squeezebox_volume
+ - squeezebox_years
+ tags:
+ - role::munin-node
+ notify:
+ - Restart munin-node service
diff --git a/ansible/roles/munin/templates/munin-node.conf.j2 b/ansible/roles/munin-node/templates/munin-node.conf.j2
index 4e89883..4e89883 100644
--- a/ansible/roles/munin/templates/munin-node.conf.j2
+++ b/ansible/roles/munin-node/templates/munin-node.conf.j2
diff --git a/ansible/roles/munin/templates/plugin.conf.j2 b/ansible/roles/munin-node/templates/plugin.conf.j2
index 9d2c74c..9d2c74c 100644
--- a/ansible/roles/munin/templates/plugin.conf.j2
+++ b/ansible/roles/munin-node/templates/plugin.conf.j2
diff --git a/ansible/roles/munin-node/templates/plugins/ldap01/.gitkeep b/ansible/roles/munin-node/templates/plugins/ldap01/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ansible/roles/munin-node/templates/plugins/ldap01/.gitkeep
diff --git a/ansible/roles/munin/templates/plugins/dovecot_maildirs.sh.j2 b/ansible/roles/munin-node/templates/plugins/lovelace/dovecot_maildirs.sh.j2
index b634df3..b634df3 100644
--- a/ansible/roles/munin/templates/plugins/dovecot_maildirs.sh.j2
+++ b/ansible/roles/munin-node/templates/plugins/lovelace/dovecot_maildirs.sh.j2
diff --git a/ansible/roles/munin/templates/plugins/lovering_inheritance.py.j2 b/ansible/roles/munin-node/templates/plugins/lovelace/lovering_inheritance.py.j2
index 4e6d315..4e6d315 100644
--- a/ansible/roles/munin/templates/plugins/lovering_inheritance.py.j2
+++ b/ansible/roles/munin-node/templates/plugins/lovelace/lovering_inheritance.py.j2
diff --git a/ansible/roles/munin/tasks/main.yml b/ansible/roles/munin/tasks/main.yml
index ab86a43..c2c6545 100644
--- a/ansible/roles/munin/tasks/main.yml
+++ b/ansible/roles/munin/tasks/main.yml
@@ -20,93 +20,3 @@
mode: "0444"
tags:
- role::munin
-
-- name: Template munin-node configuration file
- template:
- src: munin-node.conf.j2
- dest: /etc/munin/munin-node.conf
- owner: root
- group: root
- mode: "0444"
- tags:
- - role::munin
- notify:
- - Restart munin-node service
-
-- name: Template munin plugin configuration file
- template:
- src: plugin.conf.j2
- dest: /etc/munin/plugin-conf.d/custom
- owner: root
- group: root
- mode: "0444"
- tags:
- - role::munin
- notify:
- - Restart munin-node service
-
-- name: Enable non-default munin plugins
- file:
- src: "/usr/share/munin/plugins/{{ item.src }}"
- dest: "/etc/munin/plugins/{{ item.dest | default(item.src) }}"
- state: link
- loop:
- # SpamAssassin
- - src: spamstats
- # Nginx
- - src: nginx_request
- - src: nginx_status
- # Postfix
- - src: postfix_mailstats
- - src: postfix_mailqueue
- - src: postfix_mailvolume
- # PostgreSQL
- - src: postgres_size_
- dest: postgres_size_metricity
- - src: postgres_size_
- dest: postgres_size_site
- - src: postgres_size_
- dest: postgres_size_ALL
- - src: postgres_xlog
- - src: postgres_autovacuum
- - src: postgres_bgwriter
- - src: postgres_checkpoints
- - src: postgres_connections_db
- - src: postgres_users
- - src: postgres_xlog
- tags:
- - role::munin
- notify:
- - Restart munin-node service
-
-- name: Copy custom munin plugins
- template:
- src: "{{ item }}"
- # Split two levels of file extensions
- dest: "/etc/munin/plugins/{{ item | basename | splitext | first | splitext | first }}"
- owner: root
- group: root
- mode: "0555"
- loop_control:
- # I love representing data modification logic in YAML!
- label: "{{ item | basename | splitext | first | splitext | first }}"
- with_fileglob: "../templates/plugins/*"
- tags:
- - role::munin
-
-- name: Disable some unneeded plugins
- file:
- path: "/etc/munin/plugins/{{ item }}"
- state: absent
- loop:
- - squeezebox_albums
- - squeezebox_artists
- - squeezebox_genres
- - squeezebox_signalstrength
- - squeezebox_songs
- - squeezebox_volume
- - squeezebox_years
- tags:
- - role::munin
- notify:
- - Restart munin-node service