2016-12-12 12:45:30 -05:00
|
|
|
{% from "prometheus/map.jinja" import prometheus with context %}
|
|
|
|
|
|
|
|
include:
|
|
|
|
- prometheus.user
|
|
|
|
|
|
|
|
haproxy_exporter_tarball:
|
|
|
|
archive.extracted:
|
|
|
|
- name: {{ prometheus.exporters.haproxy.install_dir }}
|
|
|
|
- source: {{ prometheus.exporters.haproxy.source }}
|
|
|
|
- source_hash: {{ prometheus.exporters.haproxy.source_hash }}
|
2017-01-17 10:09:06 -05:00
|
|
|
- user: {{ prometheus.user }}
|
|
|
|
- group: {{ prometheus.group }}
|
2016-12-12 12:45:30 -05:00
|
|
|
- archive_format: tar
|
2017-01-17 10:09:06 -05:00
|
|
|
- if_missing: {{ prometheus.exporter.haproxy.version_path }}
|
2016-12-12 12:45:30 -05:00
|
|
|
|
|
|
|
haproxy_exporter_bin_link:
|
|
|
|
file.symlink:
|
|
|
|
- name: /usr/bin/haproxy_exporter
|
2017-01-17 10:09:06 -05:00
|
|
|
- target: {{ prometheus.exporter.haproxy.version_path }}/haproxy_exporter
|
2016-12-12 12:45:30 -05:00
|
|
|
- require:
|
|
|
|
- archive: haproxy_exporter_tarball
|
|
|
|
|
|
|
|
haproxy_exporter_defaults:
|
|
|
|
file.managed:
|
|
|
|
- name: /etc/default/haproxy_exporter
|
|
|
|
- source: salt://prometheus/files/default-haproxy_exporter.jinja
|
|
|
|
- template: jinja
|
|
|
|
- defaults:
|
|
|
|
scrape_uri: {{ prometheus.exporters.haproxy.args.scrape_uri }}
|
|
|
|
|
|
|
|
haproxy_exporter_service_unit:
|
|
|
|
file.managed:
|
|
|
|
{%- if grains.get('init') == 'systemd' %}
|
|
|
|
- name: /etc/systemd/system/haproxy_exporter.service
|
|
|
|
- source: salt://prometheus/files/haproxy_exporter.systemd.jinja
|
|
|
|
{%- elif grains.get('init') == 'upstart' %}
|
|
|
|
- name: /etc/init/haproxy_exporter.conf
|
|
|
|
- source: salt://prometheus/files/haproxy_exporter.upstart.jinja
|
|
|
|
{%- endif %}
|
|
|
|
- require_in:
|
|
|
|
- file: haproxy_exporter_service
|
|
|
|
|
|
|
|
haproxy_exporter_service:
|
|
|
|
service.running:
|
|
|
|
- name: haproxy_exporter
|
|
|
|
- enable: True
|
|
|
|
- reload: True
|
|
|
|
- watch:
|
2017-01-17 10:09:06 -05:00
|
|
|
- file: haproxy_exporter_service_unit
|
2016-12-12 12:45:30 -05:00
|
|
|
- file: haproxy_exporter_defaults
|
|
|
|
- file: haproxy_exporter_bin_link
|