2016-09-29 10:59:13 +02:00
|
|
|
---
|
2016-09-30 09:48:41 +02:00
|
|
|
- name: Redis is installed.
|
2016-09-29 10:59:13 +02:00
|
|
|
apt:
|
2017-09-27 17:57:02 +02:00
|
|
|
name: "{{ item }}"
|
2017-01-12 17:37:48 +01:00
|
|
|
state: present
|
2017-09-27 17:57:02 +02:00
|
|
|
with_items:
|
2017-12-27 15:10:59 +01:00
|
|
|
- redis-server
|
|
|
|
- redis-tools
|
2016-09-29 11:19:27 +02:00
|
|
|
tags:
|
2017-12-27 15:10:59 +01:00
|
|
|
- redis
|
|
|
|
- packages
|
2016-09-29 10:59:13 +02:00
|
|
|
|
2017-12-28 17:28:31 +01:00
|
|
|
- name: Get Redis version
|
2017-12-29 11:18:27 +01:00
|
|
|
shell: "redis-server -v | grep -Eo '(v=\\S+)' | cut -d'=' -f 2 | grep -E '^([0-9]|\\.)+$'"
|
2017-12-28 17:28:31 +01:00
|
|
|
changed_when: false
|
|
|
|
check_mode: no
|
|
|
|
register: _redis_installed_version
|
2018-09-19 16:25:47 +02:00
|
|
|
tags:
|
|
|
|
- redis
|
2017-12-28 17:28:31 +01:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
redis_installed_version: "{{ _redis_installed_version.stdout }}"
|
|
|
|
check_mode: no
|
2018-09-19 16:25:47 +02:00
|
|
|
tags:
|
|
|
|
- redis
|
2017-12-28 17:28:31 +01:00
|
|
|
|
2018-09-19 17:24:26 +02:00
|
|
|
- include: instances.yml
|
|
|
|
when: redis_instance_name is defined
|
|
|
|
|
2016-09-30 09:48:41 +02:00
|
|
|
- name: Redis is configured.
|
2016-09-29 10:59:13 +02:00
|
|
|
template:
|
|
|
|
src: redis.conf.j2
|
|
|
|
dest: "{{ redis_conf_path }}"
|
2017-03-23 16:59:43 +01:00
|
|
|
mode: "0644"
|
2016-09-29 10:59:13 +02:00
|
|
|
notify: restart redis
|
2018-09-19 17:24:26 +02:00
|
|
|
when: redis_instance_name is not defined
|
2016-09-29 11:19:27 +02:00
|
|
|
tags:
|
2017-12-27 15:10:59 +01:00
|
|
|
- redis
|
2016-09-29 10:59:13 +02:00
|
|
|
|
2016-09-30 09:48:41 +02:00
|
|
|
- name: Redis is running and enabled on boot.
|
2018-09-19 17:24:26 +02:00
|
|
|
systemd:
|
2016-09-29 10:59:13 +02:00
|
|
|
name: "{{ redis_daemon }}"
|
|
|
|
enabled: yes
|
|
|
|
state: started
|
2018-09-19 17:24:26 +02:00
|
|
|
when: redis_instance_name is not defined
|
2016-09-29 11:19:27 +02:00
|
|
|
tags:
|
2017-12-27 15:10:59 +01:00
|
|
|
- redis
|
2017-06-02 14:25:13 +02:00
|
|
|
|
2017-06-12 15:28:23 +02:00
|
|
|
- name: Is Munin installed
|
|
|
|
stat:
|
|
|
|
path: /etc/munin/plugins
|
|
|
|
register: _munin_installed
|
2017-12-27 15:10:59 +01:00
|
|
|
tags:
|
|
|
|
- redis
|
|
|
|
- munin
|
2017-06-12 15:28:23 +02:00
|
|
|
|
2017-06-02 14:25:13 +02:00
|
|
|
- include: munin.yml
|
2017-06-12 16:37:56 +02:00
|
|
|
when: _munin_installed.stat.exists and _munin_installed.stat.isdir
|
2017-12-27 15:10:59 +01:00
|
|
|
tags:
|
|
|
|
- redis
|
|
|
|
- munin
|
2017-09-27 18:41:21 +02:00
|
|
|
|
|
|
|
- name: is NRPE present ?
|
|
|
|
stat:
|
|
|
|
path: /etc/nagios/nrpe.d/evolix.cfg
|
|
|
|
check_mode: no
|
|
|
|
register: nrpe_evolix_config
|
2017-12-27 15:10:59 +01:00
|
|
|
tags:
|
|
|
|
- redis
|
|
|
|
- nrpe
|
2017-09-27 18:41:21 +02:00
|
|
|
|
|
|
|
- include: nrpe_stretch.yml
|
2017-09-28 18:03:26 +02:00
|
|
|
when: ansible_distribution_release == "stretch" and nrpe_evolix_config.stat.exists == true
|
2017-12-27 15:10:59 +01:00
|
|
|
tags:
|
|
|
|
- redis
|
|
|
|
- nrpe
|