Matrix Docker Ansible eploy
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

65 líneas
2.5 KiB

  1. ---
  2. - name: Ensure matrix-prometheus image is pulled
  3. docker_image:
  4. name: "{{ matrix_prometheus_docker_image }}"
  5. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  6. force_source: "{{ matrix_prometheus_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  7. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_prometheus_docker_image_force_pull }}"
  8. - name: Ensure Prometheus paths exists
  9. file:
  10. path: "{{ item }}"
  11. state: directory
  12. mode: 0750
  13. owner: "{{ matrix_user_username }}"
  14. group: "{{ matrix_user_groupname }}"
  15. with_items:
  16. - "{{ matrix_prometheus_base_path }}"
  17. - "{{ matrix_prometheus_config_path }}"
  18. - "{{ matrix_prometheus_data_path }}"
  19. - block:
  20. # Well, this actually creates the network if it doesn't exist, but..
  21. # The network should have been created by `matrix-base` already.
  22. # We don't rely on that other call and its result, because it runs
  23. # on `--tags=setup-all`, but will get skipped during `--tags=setup-prometheus`.
  24. - name: Fetch Matrix Docker network details
  25. docker_network:
  26. name: "{{ matrix_docker_network }}"
  27. driver: bridge
  28. register: matrix_docker_network_info
  29. - set_fact:
  30. matrix_prometheus_scraper_node_targets: ["{{ matrix_docker_network_info.network.IPAM.Config[0].Gateway }}:9100"]
  31. when: "matrix_prometheus_scraper_node_enabled|bool and matrix_prometheus_scraper_node_targets|length == 0"
  32. - name: Ensure prometheus.yml installed
  33. copy:
  34. content: "{{ matrix_prometheus_configuration|to_nice_yaml }}"
  35. dest: "{{ matrix_prometheus_config_path }}/prometheus.yml"
  36. mode: 0644
  37. owner: "{{ matrix_user_username }}"
  38. group: "{{ matrix_user_groupname }}"
  39. - name: Download synapse-v2.rules
  40. get_url:
  41. url: "{{ matrix_synapse_prometheus_rules_download_url }}"
  42. dest: "{{ matrix_prometheus_config_path }}/synapse-v2.rules"
  43. force: true
  44. mode: 0440
  45. owner: "{{ matrix_user_username }}"
  46. group: "{{ matrix_user_groupname }}"
  47. - name: Ensure matrix-prometheus.service installed
  48. template:
  49. src: "{{ role_path }}/templates/systemd/matrix-prometheus.service.j2"
  50. dest: "{{ matrix_systemd_path }}/matrix-prometheus.service"
  51. mode: 0644
  52. register: matrix_prometheus_systemd_service_result
  53. - name: Ensure systemd reloaded after matrix-prometheus.service installation
  54. service:
  55. daemon_reload: yes
  56. when: "matrix_prometheus_systemd_service_result.changed|bool"