1
0
Fork 0
mirror of synced 2024-12-21 22:21:07 -05:00

Merge pull request #30 from Perceptyx/master

Add default file and custom path dir creation
This commit is contained in:
Petr Michalec 2017-09-19 10:57:16 +02:00 committed by GitHub
commit 75438bf474
4 changed files with 55 additions and 3 deletions

23
grafana/files/default Normal file
View file

@ -0,0 +1,23 @@
{%- 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
# Only used on systemd systems
PID_FILE_DIR={{ server.path.pid_file_dir }}

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 = /var/lib/grafana
data = {{ server.path.data }}
#
# Directory where grafana can store logs
#
;logs = /var/log/grafana
logs = {{ server.path.logs }}
#################################### Server ####################################
[server]
@ -288,4 +288,3 @@ path = {{ server.dashboards.path }}
;enabled = false
;path = /var/lib/grafana/dashboards
{%- endif %}

View file

@ -4,6 +4,13 @@ Debian:
pkgs:
- grafana
service: grafana-server
user: grafana
group: grafana
path:
home: /usr/share/grafana
data: /var/lib/grafana
logs: /var/log/grafana
pid_file_dir: /var/run/grafana
bind:
address: 0.0.0.0
port: 3000

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) %}