mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-12-26 10:58:30 +01:00
Make --tags=setup-prometheus not break, relying on matrix-base facts
This commit is contained in:
parent
df3dd1c824
commit
85a260daaf
@ -23,7 +23,6 @@
|
|||||||
docker_network:
|
docker_network:
|
||||||
name: "{{ matrix_docker_network }}"
|
name: "{{ matrix_docker_network }}"
|
||||||
driver: bridge
|
driver: bridge
|
||||||
register: matrix_docker_network_info
|
|
||||||
|
|
||||||
- name: Ensure matrix-remove-all script created
|
- name: Ensure matrix-remove-all script created
|
||||||
template:
|
template:
|
||||||
|
@ -26,6 +26,9 @@ matrix_prometheus_systemd_wanted_services_list: []
|
|||||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9090"), or empty string to not expose.
|
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9090"), or empty string to not expose.
|
||||||
matrix_prometheus_container_http_host_bind_port: ''
|
matrix_prometheus_container_http_host_bind_port: ''
|
||||||
|
|
||||||
|
# Target addresses for the "node" scraper configuration.
|
||||||
|
# Unless you define this as a non-empty list, it gets populated at runtime with the IP address of `matrix-prometheus-node-exporter` and port 9100.
|
||||||
|
matrix_prometheus_endpoint_node_targets: []
|
||||||
|
|
||||||
# Default prometheus configuration template which covers the generic use case.
|
# Default prometheus configuration template which covers the generic use case.
|
||||||
# You can customize it by controlling the various variables inside it.
|
# You can customize it by controlling the various variables inside it.
|
||||||
|
@ -25,6 +25,21 @@
|
|||||||
- "{{ matrix_prometheus_data_path }}"
|
- "{{ matrix_prometheus_data_path }}"
|
||||||
when: matrix_prometheus_enabled|bool
|
when: matrix_prometheus_enabled|bool
|
||||||
|
|
||||||
|
- block:
|
||||||
|
# Well, this actually creates the network if it doesn't exist, but..
|
||||||
|
# The network should have been created by `matrix-base` already.
|
||||||
|
# We don't rely on that other call and its result, because it runs
|
||||||
|
# on `--tags=setup-all`, but will get skipped during `--tags=setup-prometheus`.
|
||||||
|
- name: Fetch Matrix Docker network details
|
||||||
|
docker_network:
|
||||||
|
name: "{{ matrix_docker_network }}"
|
||||||
|
driver: bridge
|
||||||
|
register: matrix_docker_network_info
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
matrix_prometheus_endpoint_node_targets: ["{{ matrix_docker_network_info.network.IPAM.Config[0].Gateway }}:9100"]
|
||||||
|
when: "matrix_prometheus_enabled|bool and matrix_prometheus_node_exporter_enabled|bool and matrix_prometheus_endpoint_node_targets|length == 0"
|
||||||
|
|
||||||
- name: Ensure prometheus.yml installed
|
- name: Ensure prometheus.yml installed
|
||||||
copy:
|
copy:
|
||||||
content: "{{ matrix_prometheus_configuration|to_nice_yaml }}"
|
content: "{{ matrix_prometheus_configuration|to_nice_yaml }}"
|
||||||
|
@ -36,5 +36,5 @@ scrape_configs:
|
|||||||
{% if matrix_prometheus_node_exporter_enabled %}
|
{% if matrix_prometheus_node_exporter_enabled %}
|
||||||
- job_name: node
|
- job_name: node
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['{{ matrix_docker_network_info.network.IPAM.Config[0].Gateway }}:9100']
|
- targets: {{ matrix_prometheus_endpoint_node_targets|to_json }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user