From d09c8fb1ab2463d4435de7791753973a7ec8ca30 Mon Sep 17 00:00:00 2001 From: saibotk Date: Tue, 8 Jun 2021 18:36:39 +0200 Subject: [PATCH] monitoring: Add feature toggles to grafana config This change allows to activate the new alerts 2.0 with the ngalert flag. --- roles/monitoring/defaults/main.yml | 3 +++ roles/monitoring/templates/docker-compose.yml | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/roles/monitoring/defaults/main.yml b/roles/monitoring/defaults/main.yml index 2e9e582..091a311 100644 --- a/roles/monitoring/defaults/main.yml +++ b/roles/monitoring/defaults/main.yml @@ -59,6 +59,9 @@ monitoring_grafana_oauth: client_id: "grafana" client_secret: "something-secret123" +# Additional feature toggles to enable (See https://grafana.com/docs/grafana/latest/administration/configuration/#feature_toggles) +monitoring_grafana_feature_toggles: [] + # The influxdb admin credentials that should be created monitoring_influxdb_admin_username: "admin" monitoring_influxdb_admin_password: "{{ lookup('passwordstore', monitoring_influxdb_domain + '/db-admin create=true length=42') }}" diff --git a/roles/monitoring/templates/docker-compose.yml b/roles/monitoring/templates/docker-compose.yml index cc201b9..61675b9 100644 --- a/roles/monitoring/templates/docker-compose.yml +++ b/roles/monitoring/templates/docker-compose.yml @@ -48,6 +48,10 @@ services: - "GF_AUTH_GENERIC_OAUTH_ROLE_ATTRIBUTE_PATH=contains(roles[*], 'Admin') && 'Admin' || contains(roles[*], 'Editor') && 'Editor' || 'Viewer'" {% endif %} +{% if monitoring_grafana_feature_toggles is defined and monitoring_grafana_feature_toggles is iterable and monitoring_grafana_feature_toggles | length > 0 %} + - "GF_FEATURE_TOGGLES_ENABLE={% for item in monitoring_grafana_feature_toggles %}{{item}} {% endfor %}" +{% endif %} + restart: always labels: - "traefik.enable=true"