Merge pull request #30 from Perceptyx/master
Add default file and custom path dir creation
This commit is contained in:
commit
75438bf474
4 changed files with 55 additions and 3 deletions
23
grafana/files/default
Normal file
23
grafana/files/default
Normal 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 }}
|
|
@ -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 %}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) %}
|
||||
|
|
Loading…
Reference in a new issue