Added grafana role automation.
--- a/prometheus/server/defaults/main.yaml Sun Jun 28 09:00:01 2020 -0500
+++ b/prometheus/server/defaults/main.yaml Sun Jun 28 10:32:15 2020 -0500
@@ -4,3 +4,6 @@
prometheus_server_apt_packages:
- "prometheus"
- "grafana"
+
+prometheus_server_grafana_plugins:
+ - "flant-statusmap-panel"
--- a/prometheus/server/tasks/main.yaml Sun Jun 28 09:00:01 2020 -0500
+++ b/prometheus/server/tasks/main.yaml Sun Jun 28 10:32:15 2020 -0500
@@ -21,4 +21,31 @@
- restart prometheus service
- restart grafana service
-# /etc/grafana/grafana.ini
+- name: install grafana prometheus data source
+ become: yes
+ grafana_datasource:
+ name: "Prometheus"
+ ds_type: "prometheus"
+ ds_url: "http://localhost:9090"
+ grafana_url: "http://localhost:3000"
+ is_default: yes
+
+- name: install grafana plugins
+ become: yes
+ grafana_plugin: name="{{item}}"
+ loop: "{{prometheus_server_grafana_plugins}}"
+
+- name: copy dashboards to target
+ become: yes
+ copy:
+ src: "{{prometheus_server_grafana_dashboard_src}}/{{item}}"
+ dest: "/tmp/"
+ mode: "0640"
+ loop: "{{prometheus_server_grafana_dashboards}}"
+
+- name: install grafana dashboards
+ become: yes
+ grafana_dashboard:
+ grafana_url: "http://localhost:3000"
+ path: "/tmp/{{item}}"
+ loop: "{{prometheus_server_grafana_dashboards}}"