2017-10-30 19:54:47 -04:00
|
|
|
{% 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
|
|
|
|
{% if consul.service != False %}
|
|
|
|
- watch_in:
|
|
|
|
- service: consul
|
|
|
|
{% endif %}
|
|
|
|
- user: consul
|
|
|
|
- group: consul
|
|
|
|
- require:
|
|
|
|
- user: consul
|
2017-10-30 19:54:47 -04:00
|
|
|
- formatter: json
|
|
|
|
- dataset: {{ consul.config }}
|
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 }}
|
2015-10-22 15:29:19 -04:00
|
|
|
- user: consul
|
|
|
|
- group: consul
|
|
|
|
- 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
|
|
|
|
- group: consul
|
|
|
|
- require:
|
|
|
|
- user: consul
|
2017-10-30 19:54:47 -04:00
|
|
|
- formatter: json
|
|
|
|
- dataset:
|
|
|
|
services: {{ consul.register }}
|