2016-10-24 06:43:23 -04:00
|
|
|
{%- from "consul/map.jinja" import consul with context -%}
|
2015-10-22 15:29:19 -04:00
|
|
|
|
2016-10-24 06:43:23 -04:00
|
|
|
consul-init-file:
|
2015-10-22 15:29:19 -04:00
|
|
|
file.managed:
|
2016-10-24 06:43:23 -04:00
|
|
|
{%- if salt['test.provider']('service') == 'systemd' %}
|
2016-04-22 06:40:14 -04:00
|
|
|
- source: salt://consul/files/consul.service
|
|
|
|
- name: /etc/systemd/system/consul.service
|
|
|
|
- mode: 0644
|
2016-10-24 06:43:23 -04:00
|
|
|
{%- elif salt['test.provider']('service') == 'upstart' %}
|
2015-10-22 15:29:19 -04:00
|
|
|
- source: salt://consul/files/consul.upstart
|
|
|
|
- name: /etc/init/consul.conf
|
|
|
|
- mode: 0644
|
2016-10-24 06:43:23 -04:00
|
|
|
{%- else %}
|
2015-10-22 15:29:19 -04:00
|
|
|
- source: salt://consul/files/consul.sysvinit
|
|
|
|
- name: /etc/init.d/consul
|
|
|
|
- mode: 0755
|
2016-10-24 06:43:23 -04:00
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
{%- if consul.service %}
|
2015-10-22 15:29:19 -04:00
|
|
|
|
|
|
|
consul-service:
|
|
|
|
service.running:
|
|
|
|
- name: consul
|
2016-10-24 06:43:23 -04:00
|
|
|
- enable: True
|
|
|
|
- watch:
|
|
|
|
- file: consul-init-file
|
|
|
|
|
|
|
|
{%- endif %}
|