1
0
Fork 0
mirror of synced 2024-11-22 08:55:35 -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] [paths]
# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used) # 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 # Directory where grafana can store logs
# #
;logs = /var/log/grafana logs = {{ server.path.logs }}
#################################### Server #################################### #################################### Server ####################################
[server] [server]
@ -288,4 +288,3 @@ path = {{ server.dashboards.path }}
;enabled = false ;enabled = false
;path = /var/lib/grafana/dashboards ;path = /var/lib/grafana/dashboards
{%- endif %} {%- endif %}

View file

@ -4,6 +4,13 @@ Debian:
pkgs: pkgs:
- grafana - grafana
service: grafana-server 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: bind:
address: 0.0.0.0 address: 0.0.0.0
port: 3000 port: 3000

View file

@ -28,6 +28,14 @@ grafana_packages:
{%- endif %} {%- 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 %} {%- if server.dashboards.enabled %}
grafana_copy_default_dashboards: grafana_copy_default_dashboards:
@ -69,6 +77,20 @@ grafana_{{ theme_name }}_css_override:
{%- endfor %} {%- 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: grafana_service:
service.running: service.running:
- name: {{ server.service }} - name: {{ server.service }}
@ -78,6 +100,7 @@ grafana_service:
- init_delay: 5 - init_delay: 5
- watch: - watch:
- file: /etc/grafana/grafana.ini - file: /etc/grafana/grafana.ini
- file: /etc/default/grafana-server
{%- for plugin_name, plugin in server.get('plugins', {}).iteritems() %} {%- for plugin_name, plugin in server.get('plugins', {}).iteritems() %}
{%- if plugin.get('enabled', False) %} {%- if plugin.get('enabled', False) %}