Michael Kuty | d346020 | 2014-05-03 15:54:26 +0200 | [diff] [blame] | 1 | {% from "fluentd/map.jinja" import server with context %} |
| 2 | |
| 3 | fluentd_packages: |
| 4 | pkg.installed: |
| 5 | - names: |
| 6 | - curl |
| 7 | - libcurl-devel |
| 8 | |
| 9 | fluentd_install: |
| 10 | cmd.run: |
| 11 | - names: |
| 12 | - curl -L http://toolbelt.treasuredata.com/sh/install-redhat.sh | sh |
| 13 | - touch /root/fluentd_installed |
| 14 | - cwd: /root |
| 15 | - unless: "[ -f /root/fluentd_installed ]" |
| 16 | require: |
| 17 | - pkg: fluentd_packages |
| 18 | |
| 19 | {%- for plugin in server.get("plugins", []) %} |
Michael Kuty | ca78494 | 2014-05-04 11:45:53 +0200 | [diff] [blame] | 20 | fluentd_install_plugin_{{ plugin }}: |
Michael Kuty | d346020 | 2014-05-03 15:54:26 +0200 | [diff] [blame] | 21 | cmd.run: |
| 22 | - names: |
| 23 | - /usr/lib64/fluent/ruby/bin/fluent-gem install plugin {{ plugin }} |
| 24 | - touch /root/{{ plugin }}_installed |
| 25 | - cwd: /root |
| 26 | - unless: "[ -f /root/{{ plugin }}_installed ]" |
| 27 | require: |
| 28 | - pkg: fluentd_packages |
| 29 | {% endfor %} |
| 30 | |
| 31 | {{ server.config }}: |
| 32 | file.managed: |
| 33 | - source: salt://fluentd/conf/td-agent.conf |
| 34 | - template: jinja |
| 35 | - require: |
| 36 | - cmd: fluentd_install |
| 37 | |
| 38 | fluentd_service: |
| 39 | service.running: |
| 40 | - name: {{ server.service }} |
| 41 | - enable: True |
| 42 | - watch: |
| 43 | - file: {{ server.config }} |
| 44 | |
| 45 | {# |
| 46 | fluentd_repo: |
| 47 | pkgrepo.managed: |
| 48 | - human_name: TreasureData |
| 49 | - comments: |
| 50 | - '#http://packages.treasure-data.com/debian/RPM-GPG-KEY-td-agent' |
| 51 | - name: TreasureData |
| 52 | - baseurl: http://packages.treasure-data.com/redhat/\$basearch |
| 53 | - file: /etc/apt/sources.list.d/fluentd.list |
| 54 | - key_url: salt://fluentd/conf/treasure-data.gpg |
| 55 | - gpgcheck: 1 |
| 56 | |
| 57 | |
| 58 | - deb http://packages.treasure-data.com/{{ grains.oscodename }}/ {{ grains.oscodename }} contrib |
| 59 | #} |