2017-11-28 08:32:05 -05: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
|
2019-05-06 14:38:54 -04:00
|
|
|
- encoding: utf-8
|
2017-10-30 19:54:47 -04:00
|
|
|
- formatter: json
|
2019-05-06 14:38:54 -04:00
|
|
|
- dataset: {{ consul.config | json }}
|
2017-11-28 08:32:05 -05:00
|
|
|
- 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 }}
|
2017-11-28 05:16:19 -05:00
|
|
|
- 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 %}
|
2017-11-28 05:16:19 -05:00
|
|
|
- user: {{ consul.user }}
|
|
|
|
- group: {{ consul.group }}
|
2015-10-22 15:29:19 -04:00
|
|
|
- require:
|
2017-11-28 08:32:05 -05:00
|
|
|
- user: consul-user
|
2017-10-30 19:54:47 -04:00
|
|
|
- formatter: json
|
|
|
|
- dataset:
|
2019-05-06 14:38:54 -04:00
|
|
|
services: {{ consul.register | json }}
|