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.