aboutsummaryrefslogtreecommitdiffstats
path: root/roles/grafana/tasks/main.yml
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-12-12 16:46:59 +0000
committerRomain Gonçalves <me@rgoncalves.se>2021-12-12 16:46:59 +0000
commita988a9b62f6b18e50767288c30b869b829f72560 (patch)
tree486309802e9ad9bb63f641caa8d1b7f1abe6f642 /roles/grafana/tasks/main.yml
parent3b1b854855c703d026a47d870f71e648908e4e59 (diff)
downloadrules-a988a9b62f6b18e50767288c30b869b829f72560.tar.gz
roles: Add grafana
Diffstat (limited to 'roles/grafana/tasks/main.yml')
-rw-r--r--roles/grafana/tasks/main.yml39
1 files changed, 39 insertions, 0 deletions
diff --git a/roles/grafana/tasks/main.yml b/roles/grafana/tasks/main.yml
new file mode 100644
index 0000000..7c1a19c
--- /dev/null
+++ b/roles/grafana/tasks/main.yml
@@ -0,0 +1,39 @@
+- name: install grafana
+ package:
+ name: grafana
+ state: present
+
+- name: create grafana directory
+ file:
+ path: "{{ grafana_dir }}/{{ item }}"
+ owner: "{{ grafana_user }}"
+ group: "{{ grafana_group }}"
+ mode: 0640
+ state: directory
+ loop:
+ - ""
+ - data
+ - logs
+ - plugins
+
+- name: generate grafana configuration
+ template:
+ src: grafana.ini.j2
+ dest: "{{ grafana_configuration_file }}"
+ owner: 0
+ group: 0
+ mode: 0644
+
+- name: generate grafana data sources
+ template:
+ src: datasources-default.yml.j2
+ dest: /etc/grafana/provisioning/datasources/default.yml
+ owner: "{{ grafana_user }}"
+ group: "{{ grafana_group }}"
+ mode: 0640
+
+- name: start and enable grafana service
+ service:
+ name: grafana
+ state: restarted
+ enabled: true
remember that computers suck.