formula-consul/consul/config.sls

44 lines
1.1 KiB
Text
Raw Permalink Normal View History

{%- from slspath + '/map.jinja' import consul with context -%}
2015-10-22 15:29:19 -04:00
consul-config:
2017-10-30 19:54:47 -04:00
file.serialize:
2015-10-22 15:29:19 -04:00
- name: /etc/consul.d/config.json
2017-10-30 19:54:47 -04:00
- formatter: json
- dataset: {{ consul.config }}
- user: {{ consul.user }}
- group: {{ consul.group }}
- mode: 0640
- require:
- user: consul-user
{%- if consul.service %}
- watch_in:
- service: consul
{%- endif %}
2015-10-22 15:29:19 -04:00
{% for script in consul.scripts %}
consul-script-install-{{ loop.index }}:
file.managed:
- source: {{ script.source }}
- name: {{ script.name }}
- template: jinja
2017-09-06 09:56:28 -04:00
- context: {{ script.get('context', {}) | yaml }}
- user: {{ consul.user }}
- group: {{ consul.group }}
2015-10-22 15:29:19 -04:00
- mode: 0755
{% endfor %}
consul-script-config:
2017-10-30 19:54:47 -04:00
file.serialize:
2015-10-22 15:29:19 -04:00
- name: /etc/consul.d/services.json
{% if consul.service != False %}
- watch_in:
- service: consul
{% endif %}
- user: {{ consul.user }}
- group: {{ consul.group }}
2015-10-22 15:29:19 -04:00
- require:
- user: consul-user
2017-10-30 19:54:47 -04:00
- formatter: json
- dataset:
services: {{ consul.register }}