From cd68bfc211168f54629fd682f68dfbf1bb39b379 Mon Sep 17 00:00:00 2001
From: Kristian Klausen <kristian@klausen.dk>
Date: Sat, 22 Oct 2022 17:37:19 +0200
Subject: [PATCH] grafana: Fix disabled dashboards provisioning due to
 duplicates

Symlinking home.json to archive.json causes a duplicate, as both
dashboards have the same uid, and Grafana won't keep the dashboards
updated when there are duplicates[1]. Instead just change
default_home_dashboard_path to point to the archive.json dashboard.

[1] "dashboards provisioning provider has no database write permissions
     because of duplicates"
---
 roles/grafana/files/public-dashboards/home.json | 1 -
 roles/grafana/templates/grafana.ini.j2          | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
 delete mode 120000 roles/grafana/files/public-dashboards/home.json

diff --git a/roles/grafana/files/public-dashboards/home.json b/roles/grafana/files/public-dashboards/home.json
deleted file mode 120000
index cc23dacb5..000000000
--- a/roles/grafana/files/public-dashboards/home.json
+++ /dev/null
@@ -1 +0,0 @@
-archive.json
\ No newline at end of file
diff --git a/roles/grafana/templates/grafana.ini.j2 b/roles/grafana/templates/grafana.ini.j2
index 432a30a87..f96c8bc77 100644
--- a/roles/grafana/templates/grafana.ini.j2
+++ b/roles/grafana/templates/grafana.ini.j2
@@ -352,7 +352,7 @@ strict_transport_security_max_age_seconds = 86400
 
 # Path to the default home dashboard. If this value is empty, then Grafana uses StaticRootPath + "dashboards/home.json"
 {% if grafana_anonymous_access %}
-default_home_dashboard_path = /var/lib/grafana/public-dashboards/home.json
+default_home_dashboard_path = /var/lib/grafana/public-dashboards/archive.json
 {% else %}
 ;default_home_dashboard_path =
 {% endif %}
-- 
GitLab