Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 1 | {%- if pillar.statsd.server.enabled %} |
2 | |||||
3 | include: | ||||
4 | - nodejs | ||||
5 | - git | ||||
6 | |||||
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 7 | statsd_user: |
8 | user.present: | ||||
9 | - name: statsd | ||||
10 | - system: True | ||||
11 | - home: /srv/statsd | ||||
12 | - require: | ||||
Michael Kutý | b1bb292 | 2014-02-10 21:44:31 +0100 | [diff] [blame] | 13 | - git: https://github.com/etsy/statsd.git |
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 14 | - pkg: nodejs_packages |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 15 | |
16 | https://github.com/etsy/statsd.git: | ||||
17 | git.latest: | ||||
Ales Komarek | d16fbbc | 2014-01-19 18:04:36 +0100 | [diff] [blame] | 18 | - target: /srv/statsd/statsd |
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 19 | - require: |
20 | - pkg: git_packages | ||||
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 21 | |
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 22 | {% if grains.os_family == "Debian" %} |
Michael Kutý | b1bb292 | 2014-02-10 21:44:31 +0100 | [diff] [blame] | 23 | |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 24 | /etc/init.d/statsd: |
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 25 | file.managed: |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 26 | - source: salt://statsd/conf/init |
27 | - user: root | ||||
28 | - group: root | ||||
29 | - mode: 744 | ||||
30 | - template: jinja | ||||
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 31 | |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 32 | statsd: |
33 | service.running: | ||||
Michael Kutý | b1bb292 | 2014-02-10 21:44:31 +0100 | [diff] [blame] | 34 | - enable: true |
35 | - require: | ||||
36 | - file: /etc/init.d/statsd | ||||
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 37 | - watch: |
38 | - file: /etc/statsd/localConfig.js | ||||
Michael Kutý | e4f9d40 | 2014-04-10 10:59:17 +0200 | [diff] [blame^] | 39 | - cmd: install_statsd_deps |
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 40 | |
41 | {% endif %} | ||||
42 | |||||
Michael Kutý | 724093b | 2014-04-10 10:56:13 +0200 | [diff] [blame] | 43 | install_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ý | e4f9d40 | 2014-04-10 10:59:17 +0200 | [diff] [blame^] | 50 | |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 51 | /etc/statsd/localConfig.js: |
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 52 | file.managed: |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 53 | - source: salt://statsd/conf/localConfig.js |
54 | - user: root | ||||
55 | - group: root | ||||
56 | - mode: 644 | ||||
57 | - template: jinja | ||||
58 | |||||
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 59 | /var/log/statsd: |
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 60 | file.directory: |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 61 | - user: statsd |
62 | - group: statsd | ||||
63 | - mode: 777 | ||||
64 | - require: | ||||
65 | - user: statsd | ||||
66 | |||||
Michael Kutý | b1bb292 | 2014-02-10 21:44:31 +0100 | [diff] [blame] | 67 | {%- for backend in pillar.statsd.server.backends %} |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 68 | |
69 | {%- if backend.type == 'amqp' %} | ||||
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 70 | |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 71 | #statsd_amqp_package: |
72 | # npm.installed: | ||||
73 | # - name: statsd-amqp-backend | ||||
74 | |||||
75 | install_package: | ||||
76 | cmd.run: | ||||
77 | - name: npm install statsd-amqp-backend | ||||
78 | |||||
79 | {%- endif %} | ||||
80 | |||||
81 | {%- endfor %} | ||||
82 | |||||
83 | {%- endif %} |