Skip to content

Commit f418f5f

Browse files
Make prometheus reverse proxy upstream variable (#101)
1 parent 65a3345 commit f418f5f

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

roles/rproxy/defaults/main/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ rproxy_ssl_cert_as_base64: "{{ nginx_ssl_cert_as_base64 }}"
1515
rproxy_ssl_key: "{{ nginx_ssl_key }}"
1616
rproxy_ssl_key_as_base64: "{{ nginx_ssl_key_as_base64 }}"
1717
rproxy_provision_prometheus: false
18+
rproxy_prometheus_upstream_name: "prometheus"
1819
rproxy_prometheus_host: "{{ trento_prometheus_effective_host }}"
1920
rproxy_prometheus_port: "{{ trento_prometheus_port }}"

roles/rproxy/tasks/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
web_upstream: "{{ rproxy_web_upstream_name }}"
5555
wanda_upstream: "{{ rproxy_wanda_upstream_name }}"
5656
wanda_location: "{{ rproxy_wanda_location }}"
57+
prometheus_upstream: "{{ rproxy_prometheus_upstream_name }}"
5758
notify:
5859
- Restart nginx
5960

roles/rproxy/templates/trento.conf.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ upstream {{ wanda_upstream }} {
1212
}
1313

1414
{% if rproxy_provision_prometheus -%}
15-
upstream prometheus {
15+
upstream {{ prometheus_upstream }} {
1616
server {{ rproxy_prometheus_host }}:{{ rproxy_prometheus_port }} max_fails=5 fail_timeout=60s;
1717
}
1818
{% endif %}
@@ -49,7 +49,7 @@ server {
4949

5050
# Add final slash to replace the prometheus_location value by the value in proxy_pass
5151
# https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass
52-
proxy_pass http://prometheus/;
52+
proxy_pass http://{{ prometheus_upstream }}/;
5353
}
5454
{% endif %}
5555

0 commit comments

Comments
 (0)