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

77 lines
1.9 KiB
YAML
Raw Normal View History

2017-06-02 14:25:13 +02:00
---
- name: Install munin check dependencies
ansible.builtin.apt:
2017-06-02 14:25:13 +02:00
name: libswitch-perl
state: present
tags:
2017-12-27 15:36:45 +01:00
- redis
2017-06-02 14:25:13 +02:00
- ansible.builtin.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
ansible.builtin.file:
name: /usr/local/lib/munin/plugins/
2017-06-02 14:25:13 +02:00
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
ansible.builtin.copy:
2017-06-02 14:25:13 +02:00
src: munin_redis
dest: /usr/local/lib/munin/plugins/redis_
2017-06-02 14:25:13 +02:00
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
ansible.builtin.file:
src: /usr/local/lib/munin/plugins/redis_
2022-06-08 15:38:48 +02:00
dest: "/etc/munin/plugins/redis_{{ plugin_name }}"
2017-06-02 14:25:13 +02:00
state: link
loop:
2017-06-02 14:25:13 +02:00
- 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
2022-06-08 15:38:48 +02:00
loop_control:
loop_var: plugin_name
2017-06-02 14:25:13 +02:00
notify: restart munin-node
when: not ansible_check_mode
2017-12-27 15:36:45 +01:00
tags:
- redis
- name: Count redis condif blocks in munin-node configuration
ansible.builtin.command:
cmd: 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: Configure redis plugin for munin
ansible.builtin.template:
src: templates/munin-plugin-default.conf.j2
dest: '/etc/munin/plugin-conf.d/z-evolinux-redis'
mode: "0740"
when:
- redis_password is not none
- redis_password | length > 0
- (munin_redis_blocs_in_config.stdout | int) <= 1
notify: restart munin-node
tags: redis
- name: Warn if multiple instance in munin-plugins configuration
ansible.builtin.debug:
msg: "WARNING - It seems you have multiple redis sections in your munin-node configuration - Munin config NOT changed"
when:
- redis_password is not none
- redis_password | length > 0
- (munin_redis_blocs_in_config.stdout | int) > 1