redis: Configure munin when working in instance mode

This commit is contained in:
Ludovic Poujol 2018-12-17 14:47:07 +01:00
parent fa49f249e7
commit effdb4c7eb
4 changed files with 83 additions and 1 deletions

View file

@ -12,6 +12,7 @@ The **patch** part changes incrementally at each release.
### Added
* evomaintenance: database variables must be set or the task fails
* redis: Configure munin when working in instance mode
### Changed

View file

@ -55,7 +55,19 @@
- munin
- include: munin.yml
when: _munin_installed.stat.exists and _munin_installed.stat.isdir
when:
- _munin_installed.stat.exists
- _munin_installed.stat.isdir
- redis_instance_name is not defined
tags:
- redis
- munin
- include: munin-instances.yml
when:
- _munin_installed.stat.exists
- _munin_installed.stat.isdir
- redis_instance_name is defined
tags:
- redis
- munin

View file

@ -0,0 +1,61 @@
---
- name: Install munin check dependencies
apt:
name: libswitch-perl
state: present
tags:
- redis
- include_role:
name: remount-usr
tags:
- redis
- name: Create plugin directory
file:
name: /usr/local/share/munin/
state: directory
mode: "0755"
tags:
- redis
- name: Create plugin directory
file:
name: /usr/local/share/munin/plugins/
state: directory
mode: "0755"
tags:
- redis
- name: Copy redis munin plugin
copy:
src: munin_redis
dest: /usr/local/share/munin/plugins/redis_
mode: "0755"
notify: restart munin-node
tags:
- redis
- name: Enable redis munin plugin
file:
src: /usr/local/share/munin/plugins/redis_
dest: "/etc/munin/plugins/{{ redis_instance_name }}_redis_{{item}}"
state: link
with_items:
- connected_clients
- key_ratio
- keys_per_sec
- per_sec
- used_keys
- used_memory
notify: restart munin-node
tags:
- redis
- name: Configure redis plugin for munin
template:
src: templates/munin-plugin-instances.conf.j2
dest: '/etc/munin/plugin-conf.d/evolinux.redis_{{ redis_instance_name }}'
mode: 0740
notify: restart munin-node
tags: redis

View file

@ -0,0 +1,8 @@
# Ansible managed
[{{ redis_instance_name }}_redis_*]
env.title_prefix Instance {{ redis_instance_name }}
env.port {{ redis_port }}
{% if redis_password %}
env.password {{ redis_password }}
{% endif %}