Commit 140d7d74 authored by Jelle van der Waa's avatar Jelle van der Waa 🚧 Committed by Sven-Hendrik Haase
Browse files

Automatically provision Grafana dashboards and datasources

parent 7183361c
Pipeline #1669 passed with stage
in 35 seconds
This diff is collapsed.
......@@ -12,6 +12,30 @@
- name: make nginx log dir
file: path=/var/log/nginx/{{ grafana_domain }} state=directory owner=root group=root mode=0755
- name: create grafana config directory
file: path=/etc/grafana mode=0700 owner=grafana group=grafana state=directory
- name: create grafana provisioning directory
file: path={{ item }} mode=0700 owner=grafana group=grafana state=directory
with_items:
- /etc/grafana/provisioning
- /etc/grafana/provisioning/datasources
- /etc/grafana/provisioning/dashboards
- /etc/grafana/provisioning/plugins
- /etc/grafana/provisioning/notifiers
- /var/lib/grafana/dashboards
- name: install grafana datasources provisioning
template: src=datasources.yaml.j2 dest=/etc/grafana/provisioning/datasources/prometheus.yml owner=grafana group=root mode=0600
notify: restart grafana
- name: install grafana dashboard provisioning
template: src=dashboard.yaml.j2 dest=/etc/grafana/provisioning/dashboards/dasbhoard.yml owner=grafana group=root mode=0600
notify: restart grafana
- name: copy grafana dashboards
copy: src=dashboards dest=/var/lib/grafana/dashboards owner=grafana group=grafana mode=0600
- name: install grafana config
template: src=grafana.ini.j2 dest=/etc/grafana.ini owner=grafana group=root mode=0600
notify: restart grafana
......
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
folderUid: ''
editable: false
allowUiUpdates: false
type: file
options:
path: /var/lib/grafana/dashboards
foldersFromFilesStructure: true
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://localhost:9090
......@@ -24,7 +24,7 @@
;plugins = /var/lib/grafana/plugins
# folder that contains provisioning config files that grafana will apply on startup and while running.
;provisioning = conf/provisioning
provisioning = /etc/grafana/provisioning
#################################### Server ####################################
[server]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment