blob: 5ac819ca42fb777e31dca2242fc2b3cf704f37fc [file] [log] [blame]
Ales Komarek4b6c8662014-02-24 21:48:29 +01001{%- if pillar.grafana.server.enabled %}
2
3include:
4 - git
5 - nodejs
6
7/srv/grafana:
8 file:
9 - directory
10 - mode: 755
11 - makedirs: true
12
Ales Komarek9a579052014-02-24 23:14:45 +010013{% if pillar.grafana.server.source.type == 'git' %}
14
Ales Komarek4b6c8662014-02-24 21:48:29 +010015grafana_repository:
16 git.latest:
Ales Komarek9a579052014-02-24 23:14:45 +010017 - name: {{ pillar.grafana.server.source.address }}
18 - rev: {{ pillar.grafana.server.source.rev }}
Ales Komarek4b6c8662014-02-24 21:48:29 +010019 - target: /srv/grafana/site
20 - require:
21 - file: /srv/grafana
22 - pkg: git_packages
23
Ales Komarek9a579052014-02-24 23:14:45 +010024grafana_install:
25 cmd.run:
Ales Komarek16e47252014-02-25 09:40:21 +010026 - names:
27 - npm install
28 - npm install -g grunt-cli
29 - grunt build
Ales Komarek9a579052014-02-24 23:14:45 +010030 - cwd: /srv/grafana/site
31 - unless: test -e /srv/grafana/site/node_modules
32 - require:
33 - git: grafana_repository
34
35{% endif %}
36
37/srv/grafana/site/src/config.js:
Ales Komarek4b6c8662014-02-24 21:48:29 +010038 file:
39 - managed
Ales Komarek9a579052014-02-24 23:14:45 +010040 - source: salt://grafana/conf/config.js
Ales Komarek4b6c8662014-02-24 21:48:29 +010041 - template: jinja
Ales Komarek3efe39a2014-02-25 10:04:23 +010042 - require:
43 - cmd: grafana_install
Ales Komarek4b6c8662014-02-24 21:48:29 +010044
45{%- endif %}