formula-consul/consul/service.sls

29 lines
741 B
Text
Raw Normal View History

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-init-file:
2015-10-22 15:29:19 -04:00
file.managed:
{%- if salt['test.provider']('service') == 'systemd' %}
2016-10-31 16:30:48 -04:00
- source: salt://{{ slspath }}/files/consul.service
- name: /etc/systemd/system/consul.service
- mode: 0644
{%- elif salt['test.provider']('service') == 'upstart' %}
2016-10-31 16:30:48 -04:00
- source: salt://{{ slspath }}/files/consul.upstart
2015-10-22 15:29:19 -04:00
- name: /etc/init/consul.conf
- mode: 0644
{%- else %}
2016-10-31 16:30:48 -04:00
- source: salt://{{ slspath }}/files/consul.sysvinit
2015-10-22 15:29:19 -04:00
- name: /etc/init.d/consul
- mode: 0755
{%- endif %}
{%- if consul.service %}
2015-10-22 15:29:19 -04:00
consul-service:
service.running:
- name: consul
- enable: True
- watch:
- file: consul-init-file
{%- endif %}