forked from evolix/ansible-roles
77 lines
1.5 KiB
YAML
77 lines
1.5 KiB
YAML
---
|
|
- name: Redis is installed.
|
|
apt:
|
|
name: "{{ item }}"
|
|
state: present
|
|
with_items:
|
|
- redis-server
|
|
- redis-tools
|
|
tags:
|
|
- redis
|
|
- packages
|
|
|
|
- name: Get Redis version
|
|
shell: "redis-server -v | grep -Eo '(v=\\S+)' | cut -d'=' -f 2 | grep -E '^([0-9]|\\.)+$'"
|
|
changed_when: false
|
|
check_mode: no
|
|
register: _redis_installed_version
|
|
tags:
|
|
- redis
|
|
|
|
- set_fact:
|
|
redis_installed_version: "{{ _redis_installed_version.stdout }}"
|
|
check_mode: no
|
|
tags:
|
|
- redis
|
|
|
|
- include: instances.yml
|
|
when: redis_instance_name is defined
|
|
|
|
- name: Redis is configured.
|
|
template:
|
|
src: redis.conf.j2
|
|
dest: "{{ redis_conf_path }}"
|
|
mode: "0644"
|
|
notify: restart redis
|
|
when: redis_instance_name is not defined
|
|
tags:
|
|
- redis
|
|
|
|
- name: Redis is running and enabled on boot.
|
|
systemd:
|
|
name: "{{ redis_daemon }}"
|
|
enabled: yes
|
|
state: started
|
|
when: redis_instance_name is not defined
|
|
tags:
|
|
- redis
|
|
|
|
- name: Is Munin installed
|
|
stat:
|
|
path: /etc/munin/plugins
|
|
register: _munin_installed
|
|
tags:
|
|
- redis
|
|
- munin
|
|
|
|
- include: munin.yml
|
|
when: _munin_installed.stat.exists and _munin_installed.stat.isdir
|
|
tags:
|
|
- redis
|
|
- munin
|
|
|
|
- name: is NRPE present ?
|
|
stat:
|
|
path: /etc/nagios/nrpe.d/evolix.cfg
|
|
check_mode: no
|
|
register: nrpe_evolix_config
|
|
tags:
|
|
- redis
|
|
- nrpe
|
|
|
|
- include: nrpe_stretch.yml
|
|
when: ansible_distribution_release == "stretch" and nrpe_evolix_config.stat.exists == true
|
|
tags:
|
|
- redis
|
|
- nrpe
|