Ansible/roles/sensu.sensu/tasks/Ubuntu/redis.yml

34 lines
985 B
YAML
Raw Normal View History

---
# tasks/Ubuntu/redis.yml: Deploy redis
# Specific to Ubuntu
- name: Include ansible_distribution vars
include_vars:
file: "{{ ansible_distribution }}.yml"
- name: Ensure redis is installed
apt:
name: "{{ sensu_redis_pkg_name }}"
state: "{{ sensu_redis_pkg_state }}"
update_cache: true
register: sensu_ubuntu_redis_install
# BUG: On Ubuntu 14.04, when first installed, redis, will be started
# however, the /var/run/redis/redis-server.pid file gets lost during the restart
# causing the process to be orphaned from the init system.
# We manually stop it right after install to account for this.
- name: Stop redis manually
shell: kill $(pgrep redis-server)
when:
- sensu_ubuntu_redis_install is changed
- ansible_distribution_version == '14.04'
- name: Ensure redis binds to accessible IP
lineinfile:
dest: /etc/redis/redis.conf
regexp: '^bind'
line: 'bind 0.0.0.0'
notify: restart redis service
- meta: flush_handlers