]> git-server-git.apps.pok.os.sepia.ceph.com Git - cephmetrics.git/commitdiff
Fix grafana admin user/password setting
authorBoris Ranto <branto@redhat.com>
Thu, 19 Apr 2018 21:16:16 +0000 (23:16 +0200)
committerBoris Ranto <branto@redhat.com>
Thu, 19 Apr 2018 22:01:58 +0000 (00:01 +0200)
Signed-off-by: Boris Ranto <branto@redhat.com>
ansible/README.md
ansible/playbook.yml
ansible/roles/ceph-grafana/defaults/main.yml
ansible/roles/ceph-grafana/tasks/configure_grafana.yml
ansible/roles/ceph-grafana/tasks/push_dashboards.yml
ansible/roles/ceph-grafana/templates/dashboard.yml

index a923fdaf2df6c373f4b39acdf897990f2a6fa18d..32d2e4b8c21e15919c96aca719abb9ea529332ec 100644 (file)
@@ -76,7 +76,6 @@ These variables are only relevent when `devel_mode` is true:
 ## Current Limitations
 
 - Currently, metrics are only *displayed* for `osd` and `rgw` hosts.
-- Authentication for grafana and graphite is fixed and creates a user `admin` with password `admin`.
 - Services are deployed on the dashboard host directly; there is not yet support for a containerized deployment.
 
 ## Usage
index 5cdbf63f16c5d1ca6438f124a159a0a3ddad6eee..f0cd13dd473b5fb97bd133280a3e2f8fb4f5db76 100644 (file)
@@ -75,4 +75,4 @@
   tasks:
     - name: Print dashboard URL
       debug:
-        msg: "All done! You may access your dashboard at http://{{ groups['ceph-grafana'][0] }}:3000/ with user 'admin' and password 'admin'. Note that initially the dashboard will be incomplete; after a few minutes it should have enough data collected to function properly."
+        msg: "All done! You may access your dashboard at http://{{ groups['ceph-grafana'][0] }}:3000/ with your pre-defined user and password (admin/admin by default). Note that initially the dashboard will be incomplete; after a few minutes it should have enough data collected to function properly."
index 0a4ac56f016ef49d0fd954317a7fce539c96064f..570fc86a28e1406ce42f9ce54a8785df650e5164 100644 (file)
@@ -9,9 +9,9 @@ defaults:
     # version currently only applies to containers
     version: 5.0.4
     datasource: Local
-    # Note: changing this value won't update the password in Grafana itself;
-    # change it via the web UI and then override this value to reflect.
-    user: admin
+    # You need to change these in the web UI on an already deployed machine, first
+    # New deployments work fine
+    admin_user: admin
     admin_password: admin
     plugins:
       - vonage-status-panel
index ff61dfd9ac93958b879b82b45ff2d67271c112e1..073993db627c7075e0dc1b13d997a899d8553a9a 100644 (file)
     value: "{{ ansible_fqdn }}"
   tags: [ini]
 
+- name: Set admin_user in grafana.ini
+  ini_file:
+    path: /etc/grafana/grafana.ini
+    section: security
+    option: admin_user
+    value: "{{ grafana.admin_user }}"
+  no_log: true
+  tags: [ini]
+
 - name: Set admin_password in grafana.ini
   ini_file:
     path: /etc/grafana/grafana.ini
   uri:
     url: http://localhost:3000/api/datasources
     method: POST
-    user: admin
+    user: "{{ grafana.admin_user }}"
     password: "{{ grafana.admin_password }}"
     force_basic_auth: yes
     body_format: json
   uri:
     url: "http://localhost:3000/api/datasources/id/{{ grafana.datasource }}"
     method: GET
-    user: "{{ grafana.user }}"
+    user: "{{ grafana.admin_user }}"
     password: "{{ grafana.admin_password }}"
     force_basic_auth: yes
   register: grafana_data_source_id
   uri:
     url: "http://localhost:3000/api/datasources/{{ grafana_data_source_id.json.id }}"
     method: PUT
-    user: "{{ grafana.user }}"
+    user: "{{ grafana.admin_user }}"
     password: "{{ grafana.admin_password }}"
     force_basic_auth: yes
     body_format: json
index a19adc70e12769c5bc52204479ff460e67190841..3282418d29b926da240a6adbf2a7629ea3072d6a 100644 (file)
@@ -37,7 +37,7 @@
   uri:
     url: "http://localhost:3000/api/dashboards/db/{{ item }}"
     method: GET
-    user: "{{ grafana.user }}"
+    user: "{{ grafana.admin_user }}"
     password: "{{ grafana.admin_password }}"
     force_basic_auth: yes
     status_code: 200,404
@@ -58,7 +58,7 @@
   uri:
     url: "http://localhost:3000/api/dashboards/db"
     method: POST
-    user: "{{ grafana.user }}"
+    user: "{{ grafana.admin_user }}"
     password: "{{ grafana.admin_password }}"
     force_basic_auth: yes
     status_code: 200
@@ -71,7 +71,7 @@
   uri:
     url: "http://localhost:3000/api/dashboards/db/ceph-at-a-glance"
     method: GET
-    user: "{{ grafana.user }}"
+    user: "{{ grafana.admin_user }}"
     password: "{{ grafana.admin_password }}"
     force_basic_auth: yes
     status_code: 200
@@ -82,7 +82,7 @@
   uri:
     url: http://localhost:3000/api/org/preferences
     method: PUT
-    user: "{{ grafana.user }}"
+    user: "{{ grafana.admin_user }}"
     password: "{{ grafana.admin_password }}"
     force_basic_auth: yes
     status_code: 200
index d4d3263c502e4b82f8b3e44a5dd728bd9372c0db..1ad3bee792b29054096f2c82eb4fa994c1eef0a7 100644 (file)
@@ -18,7 +18,7 @@ _dashboards:
   - network-usage-by-node
   - osd-node-detail
 _credentials:
-  user: admin
+  user: {{ grafana.admin_user }}
   password: {{ grafana.admin_password }}
 _grafana_port: 3000
 _home_dashboard: ceph-at-a-glance