1
0
Fork 0
mirror of synced 2024-10-09 13:39:03 -04:00

Ensure custom paths are created and have correct permissions.

This commit is contained in:
abednarik 2017-08-06 22:30:31 -03:00
parent 69e22ffac2
commit 6566e96e22
4 changed files with 49 additions and 3 deletions

20
grafana/files/default Normal file
View file

@ -0,0 +1,20 @@
{%- from "grafana/map.jinja" import server with context %}
GRAFANA_USER={{ server.user }}
GRAFANA_GROUP={{ server.group }}
GRAFANA_HOME=/usr/share/grafana
LOG_DIR={{ server.path.logs }}
DATA_DIR={{ server.path.data }}
MAX_OPEN_FILES=10000
CONF_DIR=/etc/grafana
CONF_FILE=/etc/grafana/grafana.ini
RESTART_ON_UPGRADE=true
PLUGINS_DIR={{ server.path.data }}/plugins

View file

@ -11,11 +11,11 @@
[paths]
# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
#
data = {{ server.paths.data }}
data = {{ server.path.data }}
#
# Directory where grafana can store logs
#
logs = {{ server.paths.logs }}
logs = {{ server.path.logs }}
#################################### Server ####################################
[server]

View file

@ -4,7 +4,10 @@ Debian:
pkgs:
- grafana
service: grafana-server
paths:
user: grafana
group: grafana
path:
home: /usr/share/grafana
data: /var/lib/grafana
logs: /var/log/grafana
bind:

View file

@ -28,6 +28,14 @@ grafana_packages:
{%- endif %}
/etc/default/grafana-server:
file.managed:
- name: /etc/default/grafana-server
- source: salt://grafana/files/default
- template: jinja
- require:
- pkg: grafana_packages
{%- if server.dashboards.enabled %}
grafana_copy_default_dashboards:
@ -69,6 +77,20 @@ grafana_{{ theme_name }}_css_override:
{%- endfor %}
{{server.path.data}}:
file.directory:
- makedirs: True
- mode: 755
- user: {{ server.user }}
- group: {{ server.group }}
{{server.path.logs}}:
file.directory:
- makedirs: True
- mode: 755
- user: {{ server.user }}
- group: {{ server.group }}
grafana_service:
service.running:
- name: {{ server.service }}
@ -78,6 +100,7 @@ grafana_service:
- init_delay: 5
- watch:
- file: /etc/grafana/grafana.ini
- file: /etc/default/grafana-server
{%- for plugin_name, plugin in server.get('plugins', {}).iteritems() %}
{%- if plugin.get('enabled', False) %}