From 3e582a05fa1fe9e6454342ddc3142215e78360b4 Mon Sep 17 00:00:00 2001
From: "yj.bai" <bai.yongjun@99cloud.net>
Date: Thu, 5 Mar 2020 10:59:29 +0800
Subject: [PATCH] support ipv6 for grafana.ini.j2

grafana not support ipv6 in grafana.ini.j2.

Closes-Bug: #1866141

Change-Id: Ia89a9283e70c10a624f25108b487528dbb370ee4
Signed-off-by: yj.bai <bai.yongjun@99cloud.net>
---
 ansible/roles/grafana/templates/grafana.ini.j2       | 2 +-
 releasenotes/notes/bug-1866141-dc4bfaa2f7c31198.yaml | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
 create mode 100644 releasenotes/notes/bug-1866141-dc4bfaa2f7c31198.yaml

diff --git a/ansible/roles/grafana/templates/grafana.ini.j2 b/ansible/roles/grafana/templates/grafana.ini.j2
index e9908ca8c0..e6a8575842 100644
--- a/ansible/roles/grafana/templates/grafana.ini.j2
+++ b/ansible/roles/grafana/templates/grafana.ini.j2
@@ -6,7 +6,7 @@ provisioning = /etc/grafana/provisioning
 
 [server]
 protocol = http
-http_addr = {{ api_interface_address }}
+http_addr = {{ api_interface_address | put_address_in_context('url') }}
 http_port = {{ grafana_server_port }}
 
 router_logging = true
diff --git a/releasenotes/notes/bug-1866141-dc4bfaa2f7c31198.yaml b/releasenotes/notes/bug-1866141-dc4bfaa2f7c31198.yaml
new file mode 100644
index 0000000000..eb3fbf3cd4
--- /dev/null
+++ b/releasenotes/notes/bug-1866141-dc4bfaa2f7c31198.yaml
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Fixes an issue with deploying Grafana when using IPv6.
+    `LP#1866141 <https://launchpad.net/bugs/1866141>`__