Add http_addr option to grafana config

We have no reason to make grafana container
listen on *:<port>, so this change adds the
http_addr option to the grafana config file
and adds the related option on the wait_for
tasks.
Since grafana_server_addr should exists, we
shouldn't rely on the _current_monitor_addr
default on prometheus/grafana templates.
This change also remove this default value
that is not necessary anymore.

Signed-off-by: fmount <fpantano@redhat.com>
(cherry picked from commit 8a666bfd15)
pull/4420/head
fmount 2019-08-23 10:00:30 +02:00 committed by Dimitri Savineau
parent ab67c6bd76
commit 159db72269
4 changed files with 5 additions and 2 deletions

View File

@ -17,6 +17,7 @@
- name: wait for grafana to be stopped
wait_for:
host: '{{ grafana_server_addr }}'
port: '{{ grafana_port }}'
state: stopped
@ -97,4 +98,5 @@
- name: wait for grafana to start
wait_for:
host: '{{ grafana_server_addr }}'
port: '{{ grafana_port }}'

View File

@ -17,7 +17,7 @@ datasources:
# <int> org id. will default to orgId 1 if not specified
orgId: 1
# <string> url
url: 'http://{{ grafana_server_addr | default(_current_monitor_address) }}:{{ prometheus_port }}'
url: 'http://{{ grafana_server_addr }}:{{ prometheus_port }}'
# <bool> enable/disable basic auth
basicAuth: false
# <bool> mark as default datasource. Max one per org

View File

@ -21,6 +21,7 @@ cert_key = /etc/grafana/ceph-dashboard.key
domain = {{ ansible_fqdn }}
protocol = {{ dashboard_protocol }}
http_port = {{ grafana_port }}
http_addr = {{ grafana_server_addr }}
[security]
admin_user = {{ grafana_admin_user }}

View File

@ -52,4 +52,4 @@ alerting:
alertmanagers:
- scheme: http
static_configs:
- targets: ['{{ grafana_server_addr | default(_current_monitor_address) }}:{{ alertmanager_port }}']
- targets: ['{{ grafana_server_addr }}:{{ alertmanager_port }}']