common.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. ---
  2. # tasks/common.yml: Deploy configurations common to client and server for Sensu
  3. - name: Include ansible_distribution vars
  4. include_vars:
  5. file: "{{ ansible_distribution }}.yml"
  6. - name: Ensure the Sensu config directory is present
  7. file:
  8. dest: "{{ sensu_config_path }}/conf.d"
  9. state: directory
  10. owner: "{{ sensu_user_name }}"
  11. group: "{{ sensu_group_name }}"
  12. mode: "0555"
  13. - name: Deploy Sensu Redis configuration
  14. template:
  15. dest: "{{ sensu_config_path }}/conf.d/redis.json"
  16. owner: "{{ sensu_user_name }}"
  17. group: "{{ sensu_group_name }}"
  18. src: "{{ sensu_redis_config }}"
  19. mode: "0640"
  20. when: sensu_deploy_redis_config
  21. notify:
  22. - restart sensu-server service
  23. - restart sensu-api service
  24. - restart sensu-enterprise service
  25. - restart sensu-client service
  26. - name: Deploy Sensu RabbitMQ configuration
  27. template:
  28. dest: "{{ sensu_config_path }}/conf.d/rabbitmq.json"
  29. owner: "{{ sensu_user_name }}"
  30. group: "{{ sensu_group_name }}"
  31. src: "{{ sensu_rabbitmq_config }}"
  32. mode: "0640"
  33. when: sensu_transport == "rabbitmq"
  34. and sensu_deploy_rabbitmq_config
  35. notify:
  36. - restart sensu-server service
  37. - restart sensu-api service
  38. - restart sensu-enterprise service
  39. - restart sensu-client service
  40. - name: Deploy Sensu transport configuration
  41. template:
  42. dest: "{{ sensu_config_path }}/conf.d/transport.json"
  43. owner: "{{ sensu_user_name }}"
  44. group: "{{ sensu_group_name }}"
  45. src: transport.json.j2
  46. mode: "0640"
  47. when: sensu_deploy_transport_config
  48. notify:
  49. - restart sensu-server service
  50. - restart sensu-api service
  51. - restart sensu-enterprise service
  52. - restart sensu-client service