use map
diff --git a/server.sls b/server.sls
index 38d23b9..926accb 100755
--- a/server.sls
+++ b/server.sls
@@ -1,4 +1,6 @@
-{%- if pillar.statsd.server.enabled %}
+{% from "statsd/map.jinja" import server with context %}
+
+{%- if server.enabled %}
include:
- nodejs
@@ -10,18 +12,16 @@
- system: True
- home: /srv/statsd
- require:
- - git: https://github.com/etsy/statsd.git
+ - git: {{ server.source }}
- pkg: nodejs_packages
-https://github.com/etsy/statsd.git:
+{{ server.source }}:
git.latest:
- target: /srv/statsd/statsd
- require:
- pkg: git_packages
-{% if grains.os_family == "Debian" %}
-
-/etc/init.d/statsd:
+{{ server.service_location }}:
file.managed:
- source: salt://statsd/conf/init
- user: root
@@ -29,26 +29,27 @@
- mode: 744
- template: jinja
-statsd:
+{% set conf = "".join((server.config_prefix,'localConfig.js'),) %}
+
+{{ server.service }}:
service.running:
- enable: true
- require:
- - file: /etc/init.d/statsd
+ - file: {{ server.service_location }}
- watch:
- - file: /etc/statsd/localConfig.js
+ - file: {{ server.config }}
- cmd: install_statsd_deps
-{% endif %}
-
install_statsd_deps:
cmd.run:
- name: npm install
- cwd: /srv/statsd/statsd/
- unless: test -e /srv/statsd/statsd/node_modules
- require:
- - git: https://github.com/etsy/statsd.git
+ - git: {{ server.source }}
-/etc/statsd/localConfig.js:
+
+{{ server.config }}:
file.managed:
- source: salt://statsd/conf/localConfig.js
- user: root