2016-10-31 16:30:48 -04:00
|
|
|
{% from slspath+"/map.jinja" import consul with context %}
|
2015-10-22 15:29:19 -04:00
|
|
|
|
|
|
|
consul-config:
|
|
|
|
file.managed:
|
|
|
|
- name: /etc/consul.d/config.json
|
|
|
|
{% if consul.service != False %}
|
|
|
|
- watch_in:
|
|
|
|
- service: consul
|
|
|
|
{% endif %}
|
|
|
|
- user: consul
|
|
|
|
- group: consul
|
|
|
|
- require:
|
|
|
|
- user: consul
|
2016-10-31 16:30:48 -04:00
|
|
|
- contents: |
|
|
|
|
{{ consul.config | json }}
|
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
|
|
|
|
- user: consul
|
|
|
|
- group: consul
|
|
|
|
- mode: 0755
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
consul-script-config:
|
|
|
|
file.managed:
|
2016-10-31 16:30:48 -04:00
|
|
|
- source: salt://{{ slspath }}/files/services.json
|
2015-10-22 15:29:19 -04:00
|
|
|
- name: /etc/consul.d/services.json
|
|
|
|
- template: jinja
|
|
|
|
{% if consul.service != False %}
|
|
|
|
- watch_in:
|
|
|
|
- service: consul
|
|
|
|
{% endif %}
|
|
|
|
- user: consul
|
|
|
|
- group: consul
|
|
|
|
- require:
|
|
|
|
- user: consul
|
2016-10-31 16:30:48 -04:00
|
|
|
- context:
|
|
|
|
register: |
|
|
|
|
{{ consul.register | json }}
|