blob: 743898df297b8eed456f59b4d53329590f3f2504 [file] [log] [blame]
Ales Komareka75a89c2014-01-19 17:50:15 +01001{%- if pillar.statsd.server.enabled %}
2
3include:
4- nodejs
5- git
6
Ales Komareka75a89c2014-01-19 17:50:15 +01007statsd_user:
8 user.present:
9 - name: statsd
10 - system: True
11 - home: /srv/statsd
12 - require:
Michael Kutýb1bb2922014-02-10 21:44:31 +010013 - git: https://github.com/etsy/statsd.git
Ales Komarekceefc482014-04-10 10:13:23 +020014 - pkg: nodejs_packages
Ales Komareka75a89c2014-01-19 17:50:15 +010015
16https://github.com/etsy/statsd.git:
17 git.latest:
Ales Komarekd16fbbc2014-01-19 18:04:36 +010018 - target: /srv/statsd/statsd
Ales Komarekceefc482014-04-10 10:13:23 +020019 - require:
20 - pkg: git_packages
Ales Komareka75a89c2014-01-19 17:50:15 +010021
Ales Komarekceefc482014-04-10 10:13:23 +020022{% if grains.os_family == "Debian" %}
Michael Kutýb1bb2922014-02-10 21:44:31 +010023
Ales Komareka75a89c2014-01-19 17:50:15 +010024/etc/init.d/statsd:
Ales Komarekceefc482014-04-10 10:13:23 +020025 file.managed:
Ales Komareka75a89c2014-01-19 17:50:15 +010026 - source: salt://statsd/conf/init
27 - user: root
28 - group: root
29 - mode: 744
30 - template: jinja
Ales Komarekceefc482014-04-10 10:13:23 +020031
Ales Komareka75a89c2014-01-19 17:50:15 +010032statsd:
33 service.running:
Michael Kutýb1bb2922014-02-10 21:44:31 +010034 - enable: true
35 - require:
36 - file: /etc/init.d/statsd
Ales Komareka75a89c2014-01-19 17:50:15 +010037 - watch:
38 - file: /etc/statsd/localConfig.js
Ales Komarekceefc482014-04-10 10:13:23 +020039
40{% endif %}
41
Ales Komareka75a89c2014-01-19 17:50:15 +010042/etc/statsd/localConfig.js:
Ales Komarekceefc482014-04-10 10:13:23 +020043 file.managed:
Ales Komareka75a89c2014-01-19 17:50:15 +010044 - source: salt://statsd/conf/localConfig.js
45 - user: root
46 - group: root
47 - mode: 644
48 - template: jinja
49
Ales Komareka75a89c2014-01-19 17:50:15 +010050/var/log/statsd:
Ales Komarekceefc482014-04-10 10:13:23 +020051 file.directory:
Ales Komareka75a89c2014-01-19 17:50:15 +010052 - user: statsd
53 - group: statsd
54 - mode: 777
55 - require:
56 - user: statsd
57
Michael Kutýb1bb2922014-02-10 21:44:31 +010058{%- for backend in pillar.statsd.server.backends %}
Ales Komareka75a89c2014-01-19 17:50:15 +010059
60{%- if backend.type == 'amqp' %}
Ales Komarekceefc482014-04-10 10:13:23 +020061
Ales Komareka75a89c2014-01-19 17:50:15 +010062#statsd_amqp_package:
63# npm.installed:
64# - name: statsd-amqp-backend
65
66install_package:
67 cmd.run:
68 - name: npm install statsd-amqp-backend
69
70{%- endif %}
71
72{%- endfor %}
73
74{%- endif %}