From 0acccc042331458b8dc480d97a9c2e62764ebd37 Mon Sep 17 00:00:00 2001 From: Alex-Welsh Date: Mon, 29 Jul 2024 14:53:24 +0100 Subject: [PATCH] Fix prometheus.yml templating This change fixes a bug in the prometheus.yml template which breaks alertmanager configuration Closes-Bug: 2076660 Change-Id: I9adf34747a22d7d5aef31fad3f68f7880e18f022 --- ansible/roles/prometheus/templates/prometheus.yml.j2 | 4 ++-- .../notes/prometheus-template-fix-b971aad477a8fdc9.yaml | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/prometheus-template-fix-b971aad477a8fdc9.yaml diff --git a/ansible/roles/prometheus/templates/prometheus.yml.j2 b/ansible/roles/prometheus/templates/prometheus.yml.j2 index 915e3f7e95..a5d9080669 100644 --- a/ansible/roles/prometheus/templates/prometheus.yml.j2 +++ b/ansible/roles/prometheus/templates/prometheus.yml.j2 @@ -254,9 +254,9 @@ scrape_configs: alerting: alertmanagers: - - static_configs: - - targets: + - static_configs: {% for host in groups["prometheus-alertmanager"] %} + - targets: - '{{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_alertmanager_port'] }}' {% if hostvars[host].prometheus_instance_label | default(false, true) %} labels: diff --git a/releasenotes/notes/prometheus-template-fix-b971aad477a8fdc9.yaml b/releasenotes/notes/prometheus-template-fix-b971aad477a8fdc9.yaml new file mode 100644 index 0000000000..5aade4453f --- /dev/null +++ b/releasenotes/notes/prometheus-template-fix-b971aad477a8fdc9.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixed an issue with the ``prometheus.yml`` template which would break when + deploying alertmanager.