ansible-roles/redis/tasks/default-munin.yml

83 lines
1.8 KiB
YAML
Raw Normal View History

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
- include_role:
2019-11-29 14:00:25 +01:00
name: evolix/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
- 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
- name: Add redis password for munin (if no more than 1 config block)
ini_file:
dest: /etc/munin/plugin-conf.d/munin-node
section: 'redis_*'
option: env.password
value: '{{ redis_password }}'
notify: restart munin-node
when:
- redis_password != ''
- redis_password != None
- (munin_redis_blocs_in_config.stdout | int) <= 1
tags: redis
- 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"
when:
- redis_password != ''
- redis_password != None
- (munin_redis_blocs_in_config.stdout | int) > 1