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

38 строки
2.2 KiB

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