formula-prometheus/prometheus/relay.sls
Bartosz Kupidura 5e9fb1d347 Allow to deploy prometheus as standalone service
Now it is able to install proemtheus on host and
use it to scrape data from other prometheuses.

Prod-related: PROD-17350

Change-Id: I11d65920c0e9b685dead22a5551521fa15d13f25
2018-03-12 17:26:06 +04:00

53 lines
1.3 KiB
Text

{% from "prometheus/map.jinja" import relay with context %}
{%- if relay.enabled %}
prometheus_relay_packages:
pkg.installed:
- names: {{ relay.pkgs }}
prometheus_relay_default_file:
file.managed:
- name: /etc/default/prometheus-relay
- source: salt://prometheus/files/relay/default
- template: jinja
{%- if grains.get('init') == 'systemd' %}
prometheus_relay_systemd_config:
file.managed:
- name: /etc/systemd/system/prometheus-relay.service
- source: salt://prometheus/files/relay/service
- makedirs: true
- user: root
- group: root
- mode: 644
- template: jinja
- require:
- file: prometheus_relay_default_file
prometheus_relay_restart_systemd:
module.wait:
- name: service.systemctl_reload
- watch:
- file: prometheus_relay_systemd_config
- watch_in:
- service: prometheus_relay_service
{%- endif %}
prometheus_relay_service:
service.running:
- name: prometheus-relay
- enable: True
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
- watch:
{%- if grains.get('init') == 'systemd' %}
- file: prometheus_relay_systemd_config
{%- endif %}
- file: prometheus_relay_default_file
- require:
- pkg: prometheus_relay_packages
{%- endif %}