aboutsummaryrefslogtreecommitdiffstats
path: root/roles/grafana/tasks
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-07-29 17:00:20 +0200
committerRomain Gonçalves <me@rgoncalves.se>2021-07-29 17:00:20 +0200
commitb232b894c3cbe087c8d504e91637dcf62199eed1 (patch)
treeea72a7d1a7f63c6425ee46785e1cec924351b2c3 /roles/grafana/tasks
parent22126073344e60c405d086df37b64da0c6d3c086 (diff)
downloadinfrastructure-b232b894c3cbe087c8d504e91637dcf62199eed1.tar.gz
Bump to third revision of homelab
Diffstat (limited to 'roles/grafana/tasks')
-rw-r--r--roles/grafana/tasks/main.yml47
1 files changed, 25 insertions, 22 deletions
diff --git a/roles/grafana/tasks/main.yml b/roles/grafana/tasks/main.yml
index 919f15e..d002b51 100644
--- a/roles/grafana/tasks/main.yml
+++ b/roles/grafana/tasks/main.yml
@@ -1,36 +1,39 @@
-
-# grafana ~~ roles/grafana/tasks/main.yml
-# grafana setup
-
----
-
- name: install grafana
- package: name=grafana state=present
+ package:
+ name: grafana
+ state: present
-- name: ensure grafana dir exists
+- name: ensure grafana directories exists
file:
- path: "{{ grafana_dir }}"
+ path: "{{ grafana_dir }}/{{ item }}"
owner: "{{ grafana_user }}"
group: "{{ grafana_group }}"
- mode: 0640
+ mode: "0640"
state: directory
+ loop:
+ - ""
+ - "data"
+ - "logs"
+ - "plugins"
- name: generate grafana configuration
template:
- src: grafana.ini.j2
+ src: etc-grafana.ini.j2
dest: /etc/grafana.ini
- owner: "{{ user_root }}"
- group: "{{ group_root }}"
- mode: 0644
+ owner: "0"
+ group: "0"
+ mode: "0644"
-- name: generate reverse proxy configuration for nginx
+- name: generate grafana data sources
template:
- src: grafana.conf.nginx.j2
- dest: /etc/nginx/conf.d/grafana.conf
- owner: "{{ user_root }}"
- group: "{{ group_root }}"
- mode: 0644
- when: ansible_distribution != "OpenBSD"
+ 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
+ service:
+ name: grafana
+ state: restarted
+ enabled: true
remember that computers suck.