diff --git a/ansible/roles/prometheus/defaults/main.yml b/ansible/roles/prometheus/defaults/main.yml index bd34484655..10745bd99c 100644 --- a/ansible/roles/prometheus/defaults/main.yml +++ b/ansible/roles/prometheus/defaults/main.yml @@ -321,3 +321,5 @@ prometheus_memcached_exporter_cmdline_extras: "" prometheus_mysqld_exporter_cmdline_extras: "" prometheus_node_exporter_cmdline_extras: "" prometheus_openstack_exporter_cmdline_extras: "" + +prometheus_alertmanager_external_url: "{{ internal_protocol }}://{{ kolla_internal_fqdn | put_address_in_context('url') }}:{{ prometheus_alertmanager_port }}" diff --git a/ansible/roles/prometheus/templates/prometheus-alertmanager.json.j2 b/ansible/roles/prometheus/templates/prometheus-alertmanager.json.j2 index 7453b5e453..06ab4132d0 100644 --- a/ansible/roles/prometheus/templates/prometheus-alertmanager.json.j2 +++ b/ansible/roles/prometheus/templates/prometheus-alertmanager.json.j2 @@ -1,5 +1,5 @@ { - "command": "/opt/prometheus_alertmanager/alertmanager --config.file=/etc/prometheus/alertmanager.yml --web.listen-address={{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_alertmanager_port }} --web.external-url={{ internal_protocol }}://{{ kolla_internal_fqdn | put_address_in_context('url') }}:{{ prometheus_alertmanager_port }} --cluster.listen-address={% if groups["prometheus-alertmanager"] | length > 1 %}{{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_alertmanager_cluster_port }} {% for host in groups["prometheus-alertmanager"] %} --cluster.peer={{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_alertmanager_cluster_port'] }}{% endfor %}{% endif %} --storage.path /var/lib/prometheus", + "command": "/opt/prometheus_alertmanager/alertmanager --config.file=/etc/prometheus/alertmanager.yml --web.listen-address={{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_alertmanager_port }} --web.external-url={{ prometheus_alertmanager_external_url }} --cluster.listen-address={% if groups["prometheus-alertmanager"] | length > 1 %}{{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_alertmanager_cluster_port }} {% for host in groups["prometheus-alertmanager"] %} --cluster.peer={{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_alertmanager_cluster_port'] }}{% endfor %}{% endif %} --storage.path /var/lib/prometheus", "config_files": [ { "source": "{{ container_config_directory }}/prometheus-alertmanager.yml", diff --git a/releasenotes/notes/fix-hardcoded-alertmanager-weburl-9413b9e82a8610ea.yaml b/releasenotes/notes/fix-hardcoded-alertmanager-weburl-9413b9e82a8610ea.yaml new file mode 100644 index 0000000000..07babad9ce --- /dev/null +++ b/releasenotes/notes/fix-hardcoded-alertmanager-weburl-9413b9e82a8610ea.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes an issue with AlertManager external Web URL being unconfigurable. + A new variable ``prometheus_alertmanager_external_url`` has been + introduced that users can use to set web.external-url to public.