Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

42 строки
2.4 KiB

  1. ---
  2. - ansible.builtin.set_fact:
  3. matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-prometheus-postgres-exporter.service'] }}"
  4. when: matrix_prometheus_postgres_exporter_enabled | bool
  5. - block:
  6. - name: Fail if matrix-nginx-proxy role already executed
  7. ansible.builtin.fail:
  8. msg: >-
  9. Trying to append postgres-exporter's reverse-proxying configuration to matrix-nginx-proxy,
  10. but it's pointless since the matrix-nginx-proxy role had already executed.
  11. To fix this, please change the order of roles in your playbook,
  12. so that the matrix-nginx-proxy role would run after the matrix-prometheus-postgres-exporter role.
  13. when: matrix_nginx_proxy_role_executed | default(False) | bool
  14. - name: Generate postgres-exporter metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/postgres-exporter)
  15. ansible.builtin.set_fact:
  16. matrix_prometheus_postgres_exporter_nginx_metrics_configuration_block: |
  17. location /metrics/postgres-exporter {
  18. {% if matrix_nginx_proxy_enabled | default(False) %}
  19. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  20. resolver 127.0.0.11 valid=5s;
  21. set $backend "matrix-prometheus-postgres-exporter:9187";
  22. proxy_pass http://$backend/metrics;
  23. {% elif matrix_prometheus_postgres_exporter_matrix_nginx_proxy_not_enabled_proxy_pass_host != '' %}
  24. proxy_pass http://{{ matrix_prometheus_postgres_exporter_matrix_nginx_proxy_not_enabled_proxy_pass_host }}/metrics;
  25. {% else %}
  26. return 404 "matrix-nginx-proxy is disabled and no host port was bound to the container, so metrics are unavailable";
  27. {% endif %}
  28. }
  29. - name: Register postgres-exporter metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/postgres-exporter)
  30. ansible.builtin.set_fact:
  31. matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
  32. {{
  33. matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks | default([])
  34. +
  35. [matrix_prometheus_postgres_exporter_nginx_metrics_configuration_block]
  36. }}
  37. when: matrix_prometheus_node_exporter_enabled | bool and matrix_prometheus_node_exporter_metrics_proxying_enabled | bool