aboutsummaryrefslogtreecommitdiffstats
path: root/roles/grafana/tasks
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2020-11-21 22:57:13 +0100
committerbinary <me@rgoncalves.se>2020-11-21 22:57:13 +0100
commit50492a1b34b6b766c1369425a27678968bb4d28e (patch)
treef5db6ca67d6e193259d786c5e3b820fab11ec235 /roles/grafana/tasks
parenta2705cf6057208708cefcfcb2ee0d285b9d3ec47 (diff)
downloadinfrastructure-50492a1b34b6b766c1369425a27678968bb4d28e.tar.gz
First try with grafana automation.
Diffstat (limited to 'roles/grafana/tasks')
-rw-r--r--roles/grafana/tasks/main.yml44
1 files changed, 44 insertions, 0 deletions
diff --git a/roles/grafana/tasks/main.yml b/roles/grafana/tasks/main.yml
new file mode 100644
index 0000000..39786af
--- /dev/null
+++ b/roles/grafana/tasks/main.yml
@@ -0,0 +1,44 @@
+
+# grafana ~~ roles/grafana/tasks/main.yml
+# grafana setup
+
+---
+
+- name: install grafana
+ package: name=grafana state=present
+
+- name: install nginx
+ package: name=nginx state=present
+
+- name: ensure grafana group exists
+ group: name=grafana state=present
+
+- name: ensure grafana user exists
+ user:
+ name: grafana
+ group: grafana
+ state: present
+
+# grafana is supposed to create grafana service!
+
+- name: generate grafana configuration
+ template:
+ src: grafana.ini.j2
+ dest: /etc/grafana.ini
+ owner: "{{ user_root }}"
+ group: "{{ grafana_group }}"
+ mode: 0640
+
+- name: generate reverse proxy configuration for nginx
+ template:
+ src: grafana_reverse.conf.j2
+ dest: /etc/nginx/conf.d/grafana_reverse.conf
+ owner: "{{ user_root }}"
+ group: "{{ group_root }}"
+ mode: 0644
+
+- name: start and enable grafana service
+ service: name=grafana state=restarted enabled=true
+
+- name: start and enable nginx for reverse proxy
+ service: name=nginx state=restarted enabled=true
remember that computers suck.