]> git-server-git.apps.pok.os.sepia.ceph.com Git - cephmetrics.git/commitdiff
Make SMTP, anonymous login and theme configuratebil 233/head
authorjjict <37104845+jjict@users.noreply.github.com>
Fri, 29 Mar 2019 12:35:37 +0000 (13:35 +0100)
committerjjict <37104845+jjict@users.noreply.github.com>
Wed, 12 Jun 2019 10:52:41 +0000 (12:52 +0200)
ansible/group_vars/all.yml.sample
ansible/roles/ceph-grafana/defaults/main.yml
ansible/roles/ceph-grafana/tasks/configure_grafana.yml

index 0358916856b9173657b22cf0e03ca2817162913d..bb42c1c9f9a2646b0c704c58fc5902da80f94e6f 100644 (file)
@@ -18,3 +18,12 @@ dummy:
 #grafana:
 #  admin_user: admin
 #  admin_password: admin
+# You may want to change the default theme to dark
+#  default_theme: light
+# If you use email alerting, configure your SMTP connection. If your SMTP Server dos not require authentication, skip smtp_user and smtp_password
+#  smtp_enabled: false
+#  smtp_host: smtp.mail.example.com:25
+#  smtp_user: username
+#  smtp_password: password
+# If you like to enable Anonymous login, set auth_anonymous to true
+#  auth_anonymous: false
index 95227cdb453f81852a0ca565117f9957a1417031..ed5f5e5ac4958e16b08f43c499673d0f69ef61ea 100644 (file)
@@ -19,6 +19,9 @@ defaults:
     # New deployments work fine
     admin_user: admin
     admin_password: admin
+    default_theme: light
+    snmp_enabled: false
+    auth_anonymous: false
     plugins:
       - vonage-status-panel
       - grafana-piechart-panel
index 31edf01395babb3bd90b39b73fffcc30ee85dbd6..05eddb6d70519472718456b12eedb951e79da1b9 100644 (file)
   no_log: true
   tags: [ini]
 
+- name: Set grafana default_theme grafana.ini
+  ini_file:
+    path: /etc/grafana/grafana.ini
+    section: users
+    option: default_theme
+    value: "{{ grafana.default_theme }}"
+  no_log: true
+  tags: [ini]
+
+- name: Set SMTP configuration in grafana.ini
+  ini_file:
+    path: /etc/grafana/grafana.ini
+    section: smtp
+    option: enabled
+    value: "{{ grafana.smtp_enabled }}"
+  no_log: true
+  tags: [ini]
+
+- name: Set SMTP host in grafana.ini
+  ini_file:
+    path: /etc/grafana/grafana.ini
+    section: smtp
+    option: host
+    value: "{{ grafana.smtp_host }}"
+  no_log: true
+  tags: [ini]
+  when: grafana.smtp_enabled
+
+- name: Set SMTP user in grafana.ini
+  ini_file:
+    path: /etc/grafana/grafana.ini
+    section: smtp
+    option: user
+    value: "{{ grafana.smtp_user }}"
+  no_log: true
+  tags: [ini]
+  when: grafana.smtp_enabled and grafana.smtp_user is defined
+
+- name: Set SMTP password in grafana.ini
+  ini_file:
+    path: /etc/grafana/grafana.ini
+    section: smtp
+    option: password
+    value: "{{ grafana.smtp_password }}"
+  no_log: true
+  tags: [ini]
+  when: grafana.smtp_enabled and grafana.smtp_password is defined
+
+- name: Set anonymous login in grafana.ini
+  ini_file:
+    path: /etc/grafana/grafana.ini
+    section: auth.anonymous
+    option: enabled
+    value: "{{ grafana.auth_anonymous }}"
+  no_log: true
+  tags: [ini]
+  when: grafana.auth_anonymous
+
 - include: grafana_plugins.yml
   when:
     - devel_mode