]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Use grafana_server_addr to set prometheus networks list
authorJohn Fulton <fulton@redhat.com>
Thu, 6 Feb 2025 00:01:08 +0000 (19:01 -0500)
committerTeoman ONAY <tonay@ibm.com>
Thu, 6 Feb 2025 15:12:20 +0000 (16:12 +0100)
When dashboard is enabled and module ceph_orch_apply is
called, if the grafana_server_addr is defined, then it
is used to populate the networks list in the spec of type
alertmanager. This is the case without this patch. With
this patch the same logic is applied to the spec of type
prometheus. Also, if the grafana_server_addr is a comma
delimited list, then a jinja2 expression handles passing
the IPs as a list.

Without this patch prometheus binds to all networks even
if grafana_server_addr is set which can create conflicts
with other services.

Fixes: https://bugzilla.redhat.com/2269009
Signed-off-by: John Fulton <fulton@redhat.com>
infrastructure-playbooks/cephadm-adopt.yml

index 421d86eb72a8abcae081aeab4d9c470e4c7dd6e2..25cc2000e89b344cab066c8132f6d3f12699b654 100644 (file)
                 label: "{{ monitoring_group_name }}"
                 count: "{{ groups.get(monitoring_group_name, []) | length }}"
               {% if grafana_server_addr is defined %}
-              networks:
-              - {{ grafana_server_addr }}
+              networks: {{ grafana_server_addr.split(',') | list if ',' in grafana_server_addr else grafana_server_addr | string }}
               {% endif %}
           delegate_to: "{{ groups[mon_group_name][0] }}"
           environment:
               placement:
                 label: {{ monitoring_group_name }}
                 count: {{ groups.get(monitoring_group_name, []) | length }}
+              {% if grafana_server_addr is defined %}
+              networks: {{ grafana_server_addr.split(',') | list if ',' in grafana_server_addr else grafana_server_addr | string }}
+              {% endif %}
               {% if prometheus_port is defined and prometheus_port != 9095 %}
               spec:
                 port: {{ prometheus_port }}