redis.yml 985 B

123456789101112131415161718192021222324252627282930313233
  1. ---
  2. # tasks/Ubuntu/redis.yml: Deploy redis
  3. # Specific to Ubuntu
  4. - name: Include ansible_distribution vars
  5. include_vars:
  6. file: "{{ ansible_distribution }}.yml"
  7. - name: Ensure redis is installed
  8. apt:
  9. name: "{{ sensu_redis_pkg_name }}"
  10. state: "{{ sensu_redis_pkg_state }}"
  11. update_cache: true
  12. register: sensu_ubuntu_redis_install
  13. # BUG: On Ubuntu 14.04, when first installed, redis, will be started
  14. # however, the /var/run/redis/redis-server.pid file gets lost during the restart
  15. # causing the process to be orphaned from the init system.
  16. # We manually stop it right after install to account for this.
  17. - name: Stop redis manually
  18. shell: kill $(pgrep redis-server)
  19. when:
  20. - sensu_ubuntu_redis_install is changed
  21. - ansible_distribution_version == '14.04'
  22. - name: Ensure redis binds to accessible IP
  23. lineinfile:
  24. dest: /etc/redis/redis.conf
  25. regexp: '^bind'
  26. line: 'bind 0.0.0.0'
  27. notify: restart redis service
  28. - meta: flush_handlers