Ales Komarek | 1b21d0c | 2014-08-08 08:09:47 +0200 | [diff] [blame] | 1 | {%- from "statsd/map.jinja" import server with context %} |
Michael Kutý | 1edc700 | 2014-04-12 20:14:24 +0200 | [diff] [blame] | 2 | {%- if server.enabled %} |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 3 | |
4 | include: | ||||
5 | - nodejs | ||||
6 | - git | ||||
7 | |||||
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 8 | statsd_user: |
9 | user.present: | ||||
10 | - name: statsd | ||||
11 | - system: True | ||||
12 | - home: /srv/statsd | ||||
13 | - require: | ||||
Michael Kutý | 1edc700 | 2014-04-12 20:14:24 +0200 | [diff] [blame] | 14 | - git: {{ server.source }} |
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 15 | - pkg: nodejs_packages |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 16 | |
Michael Kutý | 1edc700 | 2014-04-12 20:14:24 +0200 | [diff] [blame] | 17 | {{ server.source }}: |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 18 | git.latest: |
Ales Komarek | d16fbbc | 2014-01-19 18:04:36 +0100 | [diff] [blame] | 19 | - target: /srv/statsd/statsd |
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 20 | - require: |
21 | - pkg: git_packages | ||||
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 22 | |
Ales Komarek | a588b27 | 2014-05-08 10:40:45 +0200 | [diff] [blame] | 23 | {% set conf = "".join((server.config_prefix,'localConfig.js'),) %} |
24 | |||||
25 | {# | ||||
Michael Kutý | 1edc700 | 2014-04-12 20:14:24 +0200 | [diff] [blame] | 26 | {{ server.service_location }}: |
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 27 | file.managed: |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 28 | - source: salt://statsd/conf/init |
29 | - user: root | ||||
30 | - group: root | ||||
31 | - mode: 744 | ||||
32 | - template: jinja | ||||
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 33 | |
Michael Kutý | 1edc700 | 2014-04-12 20:14:24 +0200 | [diff] [blame] | 34 | {{ server.service }}: |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 35 | service.running: |
Michael Kutý | b1bb292 | 2014-02-10 21:44:31 +0100 | [diff] [blame] | 36 | - enable: true |
37 | - require: | ||||
Michael Kutý | 1edc700 | 2014-04-12 20:14:24 +0200 | [diff] [blame] | 38 | - file: {{ server.service_location }} |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 39 | - watch: |
Michael Kutý | 1edc700 | 2014-04-12 20:14:24 +0200 | [diff] [blame] | 40 | - file: {{ server.config }} |
Michael Kutý | e4f9d40 | 2014-04-10 10:59:17 +0200 | [diff] [blame] | 41 | - cmd: install_statsd_deps |
Ales Komarek | a588b27 | 2014-05-08 10:40:45 +0200 | [diff] [blame] | 42 | #} |
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 43 | |
Ales Komarek | c3a0ad9 | 2014-05-19 18:22:27 +0200 | [diff] [blame] | 44 | /etc/statsd: |
45 | file.directory | ||||
46 | |||||
Michael Kutý | 724093b | 2014-04-10 10:56:13 +0200 | [diff] [blame] | 47 | install_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ý | 1edc700 | 2014-04-12 20:14:24 +0200 | [diff] [blame] | 53 | - git: {{ server.source }} |
Michael Kutý | e4f9d40 | 2014-04-10 10:59:17 +0200 | [diff] [blame] | 54 | |
Michael Kutý | 1edc700 | 2014-04-12 20:14:24 +0200 | [diff] [blame] | 55 | {{ server.config }}: |
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 56 | file.managed: |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 57 | - source: salt://statsd/conf/localConfig.js |
58 | - user: root | ||||
59 | - group: root | ||||
60 | - mode: 644 | ||||
61 | - template: jinja | ||||
62 | |||||
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 63 | /var/log/statsd: |
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 64 | file.directory: |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 65 | - user: statsd |
66 | - group: statsd | ||||
67 | - mode: 777 | ||||
68 | - require: | ||||
69 | - user: statsd | ||||
70 | |||||
Ales Komarek | 1b21d0c | 2014-08-08 08:09:47 +0200 | [diff] [blame] | 71 | {%- if server.backend.engine == 'amqp' %} |
Ales Komarek | ceefc48 | 2014-04-10 10:13:23 +0200 | [diff] [blame] | 72 | |
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 73 | #statsd_amqp_package: |
74 | # npm.installed: | ||||
75 | # - name: statsd-amqp-backend | ||||
76 | |||||
77 | install_package: | ||||
78 | cmd.run: | ||||
79 | - name: npm install statsd-amqp-backend | ||||
80 | |||||
81 | {%- endif %} | ||||
82 | |||||
Ales Komarek | 1b21d0c | 2014-08-08 08:09:47 +0200 | [diff] [blame] | 83 | {%- if server.backend.engine == 'opentsdb' %} |
84 | |||||
85 | install_package: | ||||
86 | cmd.run: | ||||
87 | - name: npm install statsd-opentsdb-backend | ||||
88 | |||||
89 | {%- endif %} | ||||
Ales Komarek | a75a89c | 2014-01-19 17:50:15 +0100 | [diff] [blame] | 90 | |
91 | {%- endif %} |