blob: 38d23b97d294ee3a7c39376b18501f907f9ce06a [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
Michael Kutýe4f9d402014-04-10 10:59:17 +020039 - cmd: install_statsd_deps
Ales Komarekceefc482014-04-10 10:13:23 +020040
41{% endif %}
42
Michael Kutý724093b2014-04-10 10:56:13 +020043install_statsd_deps:
44 cmd.run:
45 - name: npm install
46 - cwd: /srv/statsd/statsd/
47 - unless: test -e /srv/statsd/statsd/node_modules
48 - require:
49 - git: https://github.com/etsy/statsd.git
Michael Kutýe4f9d402014-04-10 10:59:17 +020050
Ales Komareka75a89c2014-01-19 17:50:15 +010051/etc/statsd/localConfig.js:
Ales Komarekceefc482014-04-10 10:13:23 +020052 file.managed:
Ales Komareka75a89c2014-01-19 17:50:15 +010053 - source: salt://statsd/conf/localConfig.js
54 - user: root
55 - group: root
56 - mode: 644
57 - template: jinja
58
Ales Komareka75a89c2014-01-19 17:50:15 +010059/var/log/statsd:
Ales Komarekceefc482014-04-10 10:13:23 +020060 file.directory:
Ales Komareka75a89c2014-01-19 17:50:15 +010061 - user: statsd
62 - group: statsd
63 - mode: 777
64 - require:
65 - user: statsd
66
Michael Kutýb1bb2922014-02-10 21:44:31 +010067{%- for backend in pillar.statsd.server.backends %}
Ales Komareka75a89c2014-01-19 17:50:15 +010068
69{%- if backend.type == 'amqp' %}
Ales Komarekceefc482014-04-10 10:13:23 +020070
Ales Komareka75a89c2014-01-19 17:50:15 +010071#statsd_amqp_package:
72# npm.installed:
73# - name: statsd-amqp-backend
74
75install_package:
76 cmd.run:
77 - name: npm install statsd-amqp-backend
78
79{%- endif %}
80
81{%- endfor %}
82
83{%- endif %}