2017-06-02 14:25:13 +02:00
|
|
|
---
|
|
|
|
- name: Install munin check dependencies
|
|
|
|
apt:
|
|
|
|
name: libswitch-perl
|
|
|
|
state: present
|
|
|
|
tags:
|
2017-12-27 15:36:45 +01:00
|
|
|
- redis
|
2017-06-02 14:25:13 +02:00
|
|
|
|
2017-11-07 12:18:02 +01:00
|
|
|
- include_role:
|
|
|
|
name: remount-usr
|
|
|
|
tags:
|
2017-12-27 15:36:45 +01:00
|
|
|
- redis
|
2017-06-02 14:25:13 +02:00
|
|
|
|
|
|
|
- name: Create plugin directory
|
|
|
|
file:
|
|
|
|
name: /usr/local/share/munin/
|
|
|
|
state: directory
|
|
|
|
mode: "0755"
|
2017-12-27 15:36:45 +01:00
|
|
|
tags:
|
|
|
|
- redis
|
2017-06-02 14:25:13 +02:00
|
|
|
|
|
|
|
- name: Create plugin directory
|
|
|
|
file:
|
|
|
|
name: /usr/local/share/munin/plugins/
|
|
|
|
state: directory
|
|
|
|
mode: "0755"
|
2017-12-27 15:36:45 +01:00
|
|
|
tags:
|
|
|
|
- redis
|
2017-06-02 14:25:13 +02:00
|
|
|
|
|
|
|
- name: Copy redis munin plugin
|
|
|
|
copy:
|
|
|
|
src: munin_redis
|
|
|
|
dest: /usr/local/share/munin/plugins/redis_
|
|
|
|
mode: "0755"
|
|
|
|
notify: restart munin-node
|
2017-12-27 15:36:45 +01:00
|
|
|
tags:
|
|
|
|
- redis
|
2017-06-02 14:25:13 +02:00
|
|
|
|
|
|
|
- name: Enable redis munin plugin
|
|
|
|
file:
|
|
|
|
src: /usr/local/share/munin/plugins/redis_
|
|
|
|
dest: "/etc/munin/plugins/redis_{{item}}"
|
|
|
|
state: link
|
|
|
|
with_items:
|
|
|
|
- connected_clients
|
|
|
|
- key_ratio
|
2017-06-12 15:11:27 +02:00
|
|
|
- keys_per_sec
|
2017-06-02 14:25:13 +02:00
|
|
|
- per_sec
|
|
|
|
- used_keys
|
|
|
|
- used_memory
|
|
|
|
notify: restart munin-node
|
2017-12-27 15:36:45 +01:00
|
|
|
tags:
|
|
|
|
- redis
|
2017-09-28 15:02:29 +02:00
|
|
|
|
2017-10-03 10:21:13 +02:00
|
|
|
- name: Count redis condif blocks in munin-node configuration
|
|
|
|
command: grep -c "\[redis_" /etc/munin/plugin-conf.d/munin-node
|
|
|
|
register: munin_redis_blocs_in_config
|
|
|
|
failed_when: False
|
|
|
|
changed_when: False
|
2017-11-14 09:39:24 +01:00
|
|
|
check_mode: no
|
2017-10-03 10:21:13 +02:00
|
|
|
|
|
|
|
- name: Add redis password for munin (if no more than 1 config block)
|
2017-09-28 15:02:29 +02:00
|
|
|
ini_file:
|
|
|
|
dest: /etc/munin/plugin-conf.d/munin-node
|
|
|
|
section: 'redis_*'
|
|
|
|
option: env.password
|
|
|
|
value: '{{ redis_password }}'
|
|
|
|
notify: restart munin-node
|
2018-05-18 09:44:25 +02:00
|
|
|
when:
|
|
|
|
- redis_password != ''
|
|
|
|
- redis_password != None
|
|
|
|
- (munin_redis_blocs_in_config.stdout | int) <= 1
|
2017-09-28 15:02:29 +02:00
|
|
|
tags: redis
|
2017-10-03 10:21:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
- name: Warn if multiple instance in munin-plugins configuration
|
|
|
|
debug:
|
|
|
|
msg: "WARNING - It seems you have multiple redis sections in your munin-node configuration - Munin config NOT changed"
|
2018-05-18 09:44:25 +02:00
|
|
|
when:
|
|
|
|
- redis_password != ''
|
|
|
|
- redis_password != None
|
|
|
|
- (munin_redis_blocs_in_config.stdout | int) > 1
|