2016-10-04 11:03:07 -04:00
|
|
|
{% from "prometheus/map.jinja" import prometheus with context %}
|
|
|
|
|
|
|
|
include:
|
|
|
|
- prometheus.user
|
|
|
|
|
|
|
|
prometheus_server_tarball:
|
|
|
|
archive.extracted:
|
|
|
|
- name: {{ prometheus.server.install_dir }}
|
|
|
|
- source: {{ prometheus.server.source }}
|
|
|
|
- source_hash: {{ prometheus.server.source_hash }}
|
|
|
|
- archive_format: tar
|
2017-01-17 10:09:06 -05:00
|
|
|
- if_missing: {{ prometheus.server.version_path }}
|
2016-10-04 11:03:07 -04:00
|
|
|
|
|
|
|
prometheus_bin_link:
|
2016-10-11 12:14:24 -04:00
|
|
|
file.symlink:
|
|
|
|
- name: /usr/bin/prometheus
|
2017-01-17 10:09:06 -05:00
|
|
|
- target: {{ prometheus.server.version_path }}/prometheus
|
2016-10-04 11:03:07 -04:00
|
|
|
- require:
|
|
|
|
- archive: prometheus_server_tarball
|
|
|
|
|
|
|
|
prometheus_server_config:
|
2016-11-15 08:14:48 -05:00
|
|
|
file.serialize:
|
2016-10-04 11:03:07 -04:00
|
|
|
- name: {{ prometheus.server.args.config_file }}
|
2017-01-17 10:09:06 -05:00
|
|
|
- user: {{ prometheus.user }}
|
|
|
|
- group: {{ prometheus.group }}
|
2016-11-15 08:34:04 -05:00
|
|
|
- dataset_pillar: prometheus:server:config
|
2016-10-04 11:03:07 -04:00
|
|
|
|
|
|
|
prometheus_defaults:
|
|
|
|
file.managed:
|
|
|
|
- name: /etc/default/prometheus
|
2019-05-08 17:59:42 -04:00
|
|
|
- source: salt://prometheus/files/default-prometheus.jinja
|
2016-10-04 11:03:07 -04:00
|
|
|
- template: jinja
|
|
|
|
- defaults:
|
|
|
|
config_file: {{ prometheus.server.args.config_file }}
|
|
|
|
storage_local_path: {{ prometheus.server.args.storage.local_path }}
|
2017-01-17 10:09:06 -05:00
|
|
|
web_console_libraries: {{ prometheus.server.version_path }}/console_libraries
|
|
|
|
web_console_templates: {{ prometheus.server.version_path }}/consoles
|
2016-10-04 11:03:07 -04:00
|
|
|
|
|
|
|
{%- if prometheus.server.args.storage.local_path is defined %}
|
|
|
|
prometheus_storage_local_path:
|
|
|
|
file.directory:
|
|
|
|
- name: {{ prometheus.server.args.storage.local_path }}
|
2017-01-17 10:09:06 -05:00
|
|
|
- user: {{ prometheus.user }}
|
|
|
|
- group: {{ prometheus.group }}
|
2016-10-04 11:03:07 -04:00
|
|
|
- makedirs: True
|
|
|
|
- watch:
|
|
|
|
- file: prometheus_defaults
|
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
prometheus_service_unit:
|
|
|
|
file.managed:
|
|
|
|
{%- if grains.get('init') == 'systemd' %}
|
|
|
|
- name: /etc/systemd/system/prometheus.service
|
2019-05-08 17:59:42 -04:00
|
|
|
- source: salt://prometheus/files/prometheus.systemd.jinja
|
2016-10-04 11:03:07 -04:00
|
|
|
{%- elif grains.get('init') == 'upstart' %}
|
|
|
|
- name: /etc/init/prometheus.conf
|
2019-05-08 17:59:42 -04:00
|
|
|
- source: salt://prometheus/files/prometheus.upstart.jinja
|
2016-10-04 11:03:07 -04:00
|
|
|
{%- endif %}
|
2019-05-10 03:00:52 -04:00
|
|
|
- template: jinja
|
2019-05-08 16:09:25 -04:00
|
|
|
- context:
|
|
|
|
user: {{ prometheus.user }}
|
|
|
|
group: {{ prometheus.group }}
|
|
|
|
bin_path: {{ prometheus.exporter.node.version_path }}
|
|
|
|
args: {{ prometheus.exporter.get('args', []) }}
|
2016-10-04 11:03:07 -04:00
|
|
|
- watch:
|
|
|
|
- file: prometheus_defaults
|
|
|
|
- require_in:
|
|
|
|
- file: prometheus_service
|
|
|
|
|
|
|
|
prometheus_service:
|
|
|
|
service.running:
|
|
|
|
- name: prometheus
|
|
|
|
- enable: True
|
|
|
|
- reload: True
|
|
|
|
- watch:
|
2017-01-17 10:09:06 -05:00
|
|
|
- file: prometheus_service_unit
|
2016-10-04 11:03:07 -04:00
|
|
|
- file: prometheus_server_config
|
2016-12-12 08:04:06 -05:00
|
|
|
- file: prometheus_bin_link
|