aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2021-01-22 11:46:52 +0100
committerbinary <me@rgoncalves.se>2021-01-22 11:46:52 +0100
commit642df4fb6653bd67f398a08412e77fda9b2dfe03 (patch)
treead50e720154391a3da5fff77143b8c5ca8dcecd4
parent4bedaf8f9b58985fb898784dbec896d031f4de10 (diff)
downloadinfrastructure-642df4fb6653bd67f398a08412e77fda9b2dfe03.tar.gz
Add grafana to OpenBSD cloud server
-rw-r--r--playbooks/st0cld0.rgoncalves.se.yml7
-rw-r--r--roles/grafana/meta/main.yml6
-rw-r--r--roles/grafana/tasks/main.yml26
-rw-r--r--roles/grafana/templates/grafana.conf.nginx.j2 (renamed from roles/grafana/templates/grafana_reverse.conf.j2)0
-rw-r--r--roles/grafana/templates/grafana.ini.j26
5 files changed, 19 insertions, 26 deletions
diff --git a/playbooks/st0cld0.rgoncalves.se.yml b/playbooks/st0cld0.rgoncalves.se.yml
index f1eb2b8..7f4f638 100644
--- a/playbooks/st0cld0.rgoncalves.se.yml
+++ b/playbooks/st0cld0.rgoncalves.se.yml
@@ -6,7 +6,10 @@
- hosts: st0cld0
roles:
+ # common
- { role: grafana }
- #- { role: logstash }
- - { role: jenkins }
+ - { role: kibana }
- { role: nextcloud }
+ # linux only
+ - role: nginx
+ when: ansible_distribution != "OpenBSD"
diff --git a/roles/grafana/meta/main.yml b/roles/grafana/meta/main.yml
new file mode 100644
index 0000000..21c98ab
--- /dev/null
+++ b/roles/grafana/meta/main.yml
@@ -0,0 +1,6 @@
+
+# grafana ~~ roles/grafana/meta/main.yml
+# Meta parameters
+
+---
+
diff --git a/roles/grafana/tasks/main.yml b/roles/grafana/tasks/main.yml
index 39786af..5df8fa3 100644
--- a/roles/grafana/tasks/main.yml
+++ b/roles/grafana/tasks/main.yml
@@ -7,38 +7,22 @@
- 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
+ group: "{{ group_root }}"
+ mode: 0644
- name: generate reverse proxy configuration for nginx
template:
- src: grafana_reverse.conf.j2
- dest: /etc/nginx/conf.d/grafana_reverse.conf
+ src: grafana.conf.nginx.j2
+ dest: /etc/nginx/conf.d/grafana.conf
owner: "{{ user_root }}"
group: "{{ group_root }}"
mode: 0644
+ when: ansible_distribution != "OpenBSD"
- 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
diff --git a/roles/grafana/templates/grafana_reverse.conf.j2 b/roles/grafana/templates/grafana.conf.nginx.j2
index c0f926c..c0f926c 100644
--- a/roles/grafana/templates/grafana_reverse.conf.j2
+++ b/roles/grafana/templates/grafana.conf.nginx.j2
diff --git a/roles/grafana/templates/grafana.ini.j2 b/roles/grafana/templates/grafana.ini.j2
index 16453b8..75de264 100644
--- a/roles/grafana/templates/grafana.ini.j2
+++ b/roles/grafana/templates/grafana.ini.j2
@@ -15,7 +15,7 @@ instance_name = <rgoncalves.se monitoring>
#################################### Paths ####################################
[paths]
# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
-;data = /var/lib/grafana
+data = {{ grafana_dir }}
# Temporary files in `data` directory older than given duration will be removed
;temp_data_lifetime = 24h
@@ -24,7 +24,7 @@ instance_name = <rgoncalves.se monitoring>
;logs = /var/log/grafana
# Directory where grafana will automatically scan and look for plugins
-;plugins = /var/lib/grafana/plugins
+;plugins = {{ grafana_dir }}/plugins
# folder that contains provisioning config files that grafana will apply on startup and while running.
;provisioning = conf/provisioning
@@ -35,7 +35,7 @@ instance_name = <rgoncalves.se monitoring>
;protocol = http
# The ip address to bind to, empty will bind to all interfaces
-;http_addr = 192.168.5.1
+http_addr =
# The http port to use
http_port = {{ grafana_port }}
remember that computers suck.