blob: 329ddb37e7e83898a7511208d22f65f08a384cc2 [file] [log] [blame]
Ales Komarek1b21d0c2014-08-08 08:09:47 +02001{%- from "statsd/map.jinja" import server with context %}
Michael Kutý1edc7002014-04-12 20:14:24 +02002{%- if server.enabled %}
Ales Komareka75a89c2014-01-19 17:50:15 +01003
4include:
5- nodejs
6- git
7
Ales Komareka75a89c2014-01-19 17:50:15 +01008statsd_user:
9 user.present:
10 - name: statsd
11 - system: True
12 - home: /srv/statsd
13 - require:
Michael Kutý1edc7002014-04-12 20:14:24 +020014 - git: {{ server.source }}
Ales Komarekceefc482014-04-10 10:13:23 +020015 - pkg: nodejs_packages
Ales Komareka75a89c2014-01-19 17:50:15 +010016
Michael Kutý1edc7002014-04-12 20:14:24 +020017{{ server.source }}:
Ales Komareka75a89c2014-01-19 17:50:15 +010018 git.latest:
Ales Komarekd16fbbc2014-01-19 18:04:36 +010019 - target: /srv/statsd/statsd
Ales Komarekceefc482014-04-10 10:13:23 +020020 - require:
21 - pkg: git_packages
Ales Komareka75a89c2014-01-19 17:50:15 +010022
Ales Komareka588b272014-05-08 10:40:45 +020023{% set conf = "".join((server.config_prefix,'localConfig.js'),) %}
24
25{#
Michael Kutý1edc7002014-04-12 20:14:24 +020026{{ server.service_location }}:
Ales Komarekceefc482014-04-10 10:13:23 +020027 file.managed:
Ales Komareka75a89c2014-01-19 17:50:15 +010028 - source: salt://statsd/conf/init
29 - user: root
30 - group: root
31 - mode: 744
32 - template: jinja
Ales Komarekceefc482014-04-10 10:13:23 +020033
Michael Kutý1edc7002014-04-12 20:14:24 +020034{{ server.service }}:
Ales Komareka75a89c2014-01-19 17:50:15 +010035 service.running:
Michael Kutýb1bb2922014-02-10 21:44:31 +010036 - enable: true
37 - require:
Michael Kutý1edc7002014-04-12 20:14:24 +020038 - file: {{ server.service_location }}
Ales Komareka75a89c2014-01-19 17:50:15 +010039 - watch:
Michael Kutý1edc7002014-04-12 20:14:24 +020040 - file: {{ server.config }}
Michael Kutýe4f9d402014-04-10 10:59:17 +020041 - cmd: install_statsd_deps
Ales Komareka588b272014-05-08 10:40:45 +020042#}
Ales Komarekceefc482014-04-10 10:13:23 +020043
Ales Komarekc3a0ad92014-05-19 18:22:27 +020044/etc/statsd:
45 file.directory
46
Michael Kutý724093b2014-04-10 10:56:13 +020047install_statsd_deps:
48 cmd.run:
49 - name: npm install
50 - cwd: /srv/statsd/statsd/
51 - unless: test -e /srv/statsd/statsd/node_modules
52 - require:
Michael Kutý1edc7002014-04-12 20:14:24 +020053 - git: {{ server.source }}
Michael Kutýe4f9d402014-04-10 10:59:17 +020054
Michael Kutý1edc7002014-04-12 20:14:24 +020055{{ server.config }}:
Ales Komarekceefc482014-04-10 10:13:23 +020056 file.managed:
Ales Komareka75a89c2014-01-19 17:50:15 +010057 - source: salt://statsd/conf/localConfig.js
58 - user: root
59 - group: root
60 - mode: 644
61 - template: jinja
62
Ales Komareka75a89c2014-01-19 17:50:15 +010063/var/log/statsd:
Ales Komarekceefc482014-04-10 10:13:23 +020064 file.directory:
Ales Komareka75a89c2014-01-19 17:50:15 +010065 - user: statsd
66 - group: statsd
67 - mode: 777
68 - require:
69 - user: statsd
70
Ales Komarek1b21d0c2014-08-08 08:09:47 +020071{%- if server.backend.engine == 'amqp' %}
Ales Komarekceefc482014-04-10 10:13:23 +020072
Ales Komareka75a89c2014-01-19 17:50:15 +010073#statsd_amqp_package:
74# npm.installed:
75# - name: statsd-amqp-backend
76
77install_package:
78 cmd.run:
79 - name: npm install statsd-amqp-backend
80
81{%- endif %}
82
Ales Komarek1b21d0c2014-08-08 08:09:47 +020083{%- if server.backend.engine == 'opentsdb' %}
84
85install_package:
86 cmd.run:
87 - name: npm install statsd-opentsdb-backend
88
89{%- endif %}
Ales Komareka75a89c2014-01-19 17:50:15 +010090
91{%- endif %}