# HG changeset patch # User Luke Hoersten # Date 1593358335 18000 # Node ID 5a5071d4eaad912644df6a62d5f2ff519e74a6c7 # Parent 19fa7aa47bf1fb6488d7ca014b8e925186ee8a97 Added grafana role automation. diff -r 19fa7aa47bf1 -r 5a5071d4eaad prometheus/server/defaults/main.yaml --- 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" diff -r 19fa7aa47bf1 -r 5a5071d4eaad prometheus/server/tasks/main.yaml --- 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}}"