From 6c87e9f7a737f0632b266fd65a9b8bf8616d2758 Mon Sep 17 00:00:00 2001 From: Boris Ranto Date: Wed, 10 Jul 2019 10:19:53 +0200 Subject: [PATCH] grafana: Add option to preserve grafana config This patch adds the grafana.overwrite_config option. You can change this option if you want to keep your custom grafana configuration. The scripts will still update the grafana config with the other configured options but it won't overwrite your custom options. Signed-off-by: Boris Ranto --- ansible/group_vars/all.yml.sample | 4 ++++ ansible/roles/ceph-grafana/defaults/main.yml | 4 ++++ ansible/roles/ceph-grafana/tasks/configure_grafana.yml | 1 + 3 files changed, 9 insertions(+) diff --git a/ansible/group_vars/all.yml.sample b/ansible/group_vars/all.yml.sample index bb42c1c..b74f6cc 100644 --- a/ansible/group_vars/all.yml.sample +++ b/ansible/group_vars/all.yml.sample @@ -27,3 +27,7 @@ dummy: # smtp_password: password # If you like to enable Anonymous login, set auth_anonymous to true # auth_anonymous: false +# You can change this option if you want to keep your custom grafana configuration. +# The script will still update the grafana config with the other configured options +# but it won't overwrite your custom options. +# overwrite_config: true diff --git a/ansible/roles/ceph-grafana/defaults/main.yml b/ansible/roles/ceph-grafana/defaults/main.yml index 6eb03f5..6eefc49 100644 --- a/ansible/roles/ceph-grafana/defaults/main.yml +++ b/ansible/roles/ceph-grafana/defaults/main.yml @@ -23,6 +23,10 @@ defaults: default_theme: light snmp_enabled: false auth_anonymous: false + # You can change this option if you want to keep your custom grafana configuration. + # The script will still update the grafana config with the other configured options + # but it won't overwrite your custom options. + overwrite_config: true plugins: - vonage-status-panel - grafana-piechart-panel diff --git a/ansible/roles/ceph-grafana/tasks/configure_grafana.yml b/ansible/roles/ceph-grafana/tasks/configure_grafana.yml index 05eddb6..6560d66 100644 --- a/ansible/roles/ceph-grafana/tasks/configure_grafana.yml +++ b/ansible/roles/ceph-grafana/tasks/configure_grafana.yml @@ -16,6 +16,7 @@ owner: root group: grafana mode: 0640 + force: "{{ grafana.overwrite_config }}" tags: [ini] - name: Set owner on /etc/grafana -- 2.47.3