1
0
Fork 0
mirror of synced 2024-11-22 17:05:34 -05:00
formula-grafana/server.sls

92 lines
1.9 KiB
Text
Raw Normal View History

2014-02-24 15:48:29 -05:00
{%- if pillar.grafana.server.enabled %}
include:
- git
- nodejs
/srv/grafana:
file:
- directory
- mode: 755
- makedirs: true
2014-02-24 17:14:45 -05:00
{% if pillar.grafana.server.source.type == 'git' %}
2014-02-24 15:48:29 -05:00
grafana_repository:
git.latest:
2014-02-24 17:14:45 -05:00
- name: {{ pillar.grafana.server.source.address }}
- rev: {{ pillar.grafana.server.source.rev }}
2014-02-24 15:48:29 -05:00
- target: /srv/grafana/site
- require:
- file: /srv/grafana
- pkg: git_packages
2014-03-03 14:21:06 -05:00
/srv/grafana/site/src/config.js:
file:
- managed
- source: salt://grafana/conf/config.js
- template: jinja
- require:
- git: grafana_repository
2014-02-24 17:14:45 -05:00
grafana_install:
cmd.run:
2014-02-25 03:40:21 -05:00
- names:
- npm install
- npm install -g grunt-cli
2014-02-24 17:14:45 -05:00
- cwd: /srv/grafana/site
- unless: test -e /srv/grafana/site/node_modules
- require:
- git: grafana_repository
2014-03-03 13:54:05 -05:00
grafana_grun_build:
cmd.run:
- names:
- grunt build --force
- cwd: /srv/grafana/site
- unless: test -e /srv/grafana/site/dist
- require:
- git: grafana_repository
2014-03-03 14:21:06 -05:00
- file: /srv/grafana/site/src/config.js
2014-03-03 13:54:05 -05:00
2014-03-03 14:46:34 -05:00
{% elif pillar.grafana.server.source.type == 'pkg' %}
{% set version = pillar.grafana.server.source.rev %}
/srv/grafana/site/dist:
file:
- directory
- mode: 755
- makedirs: true
/srv/grafana/site/dist/config.js:
file:
- managed
- source: salt://grafana/conf/config.js
- template: jinja
- require:
- file: /srv/grafana/site/dist
download_grafana:
cmd.run:
- names:
- wget https://github.com/torkelo/grafana/releases/download/v{{ version }}/grafana-{{ version }}.tar.gz
- user: root
- cwd: /root
- unless: test -e /root/grafana-{{ version }}.tar.gz
untar_grafana:
cmd.run:
- names:
- tar zxvf /root/grafana-{{ version }}.tar.gz -C /srv/grafana/site/dist
- user: root
- cwd: /root
- unless: test -e /srv/grafana/dist/app
- require:
- file: /srv/grafana/site/dist/config.js
- file: /srv/grafana/site/dist
2014-02-24 17:14:45 -05:00
{% endif %}
2014-02-24 15:48:29 -05:00
{%- endif %}