Fix jmx-exporter service configuration

Change-Id: Ie889b5f8d485aa7f41166fc3f90bb6554681c68e
This commit is contained in:
Olivier Bourdon 2017-07-10 16:12:24 +02:00
parent 31bfa9d94c
commit 3b4ad1fb29

View file

@ -7,4 +7,58 @@
- names: {{ parameters.packages }} - names: {{ parameters.packages }}
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}
{{ exporter }}_exporter_service:
service.running:
- name: {{ exporter }}-exporter
- enable: True
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
- watch:
- file: {{ exporter }}_exporter_service_config_file
{%- for svc, svc_parameters in parameters.get('services', {}).iteritems() %}
{%- if svc_parameters.get('enabled', False) %}
{%- if svc_parameters.template is defined %}
{%- set jmxbind = svc_parameters.get('jmx_bind', {}) %}
{{ exporter }}_{{ svc }}_exporter_config_file:
file.managed:
- name: /etc/exporters/{{ exporter }}_{{ svc }}-running.yml
- template: jinja
- source:
- salt://{{ svc_parameters.template }}
- context:
jmxbind: {{ jmxbind }}
- user: root
- group: root
- mode: 644
- require:
- pkg: {{ exporter }}_exporter_packages
- watch_in:
- service: {{ exporter }}_exporter_service
{%- endif %}
{%- if parameters.template is defined %}
{%- set template = parameters.template %}
{%- set bind = svc_parameters.get('bind', {}) %}
{{ exporter }}_exporter_service_config_file:
file.managed:
- name: /etc/default/{{ exporter }}-exporter
- template: jinja
- source:
- salt://{{ template }}
- context:
bind: {{ bind }}
cfg_file: /etc/exporters/{{ exporter }}_{{ svc }}-running.yml
- user: root
- group: root
- mode: 644
- require:
- pkg: {{ exporter }}_exporter_packages
- watch_in:
- service: {{ exporter }}_exporter_service
{%- endif %}
{%- endif %}
{%- endfor %}
{%- endfor %} {%- endfor %}