feat(archive): managing env vars in systemd unit

* add env pillar under component:name:service
* update systemd template
This commit is contained in:
lagooj 2020-11-11 14:14:34 +01:00
parent e0f6a8baeb
commit 4e60b17741
2 changed files with 4 additions and 0 deletions

View File

@ -126,6 +126,7 @@ prometheus-archive-install-{{ name }}-managed-service:
name: {{ name }}
user: {{ name }}
group: {{ name }}
env: {{ p.pkg.component[name]['service'].get('env', [])|tojson }}
workdir: {{ p.dir.var }}/{{ name }}
stop: ''
{%- if name in ('node_exporter', 'consul_exporter') or 'config_file' not in p.pkg.component[name] %}

View File

@ -8,6 +8,9 @@ After=
Documentation=https://github.com/saltstack-formulas/prometheus-formula
[Service]
{% for var in env %}
Environment={{ var }}
{% endfor %}
User={{ user }}
Group={{ group }}
WorkingDirectory={{ workdir }}