[consul] allow rehoming

This commit is contained in:
Chris Lundquist 2016-10-31 20:30:48 +00:00
parent e1b0ba47d2
commit 6e3e2b94b9
7 changed files with 18 additions and 18 deletions

View file

@ -1,9 +1,7 @@
{% from "consul/map.jinja" import consul with context %} {% from slspath+"/map.jinja" import consul with context %}
consul-config: consul-config:
file.managed: file.managed:
- source: salt://consul/files/config.json
- template: jinja
- name: /etc/consul.d/config.json - name: /etc/consul.d/config.json
{% if consul.service != False %} {% if consul.service != False %}
- watch_in: - watch_in:
@ -13,6 +11,8 @@ consul-config:
- group: consul - group: consul
- require: - require:
- user: consul - user: consul
- contents: |
{{ consul.config | json }}
{% for script in consul.scripts %} {% for script in consul.scripts %}
consul-script-install-{{ loop.index }}: consul-script-install-{{ loop.index }}:
@ -27,7 +27,7 @@ consul-script-install-{{ loop.index }}:
consul-script-config: consul-script-config:
file.managed: file.managed:
- source: salt://consul/files/services.json - source: salt://{{ slspath }}/files/services.json
- name: /etc/consul.d/services.json - name: /etc/consul.d/services.json
- template: jinja - template: jinja
{% if consul.service != False %} {% if consul.service != False %}
@ -38,3 +38,6 @@ consul-script-config:
- group: consul - group: consul
- require: - require:
- user: consul - user: consul
- context:
register: |
{{ consul.register | json }}

View file

@ -1,2 +0,0 @@
{% from "consul/map.jinja" import consul with context %}
{{ consul.config | json}}

View file

@ -1,4 +1,3 @@
{% from "consul/map.jinja" import consul with context %}
{ {
"services": {{ consul.register | json }} "services": {{ register }}
} }

View file

@ -1,6 +1,6 @@
{% from "consul/map.jinja" import consul with context %} {% from slspath+"/map.jinja" import consul with context %}
include: include:
- consul.install - {{ slspath }}.install
- consul.config - {{ slspath }}.config
- consul.service - {{ slspath }}.service

View file

@ -1,4 +1,4 @@
{% from "consul/map.jinja" import consul with context %} {% from slspath+"/map.jinja" import consul with context %}
consul-dep-unzip: consul-dep-unzip:
pkg.installed: pkg.installed:

View file

@ -1,4 +1,4 @@
{% import_yaml "consul/defaults.yaml" as defaults %} {% import_yaml slspath+"/defaults.yaml" as defaults %}
{% set consul = salt['pillar.get']('consul', default=defaults.consul, merge=True) %} {% set consul = salt['pillar.get']('consul', default=defaults.consul, merge=True) %}

View file

@ -1,17 +1,17 @@
{%- from "consul/map.jinja" import consul with context -%} {%- from slspath+"/map.jinja" import consul with context -%}
consul-init-file: consul-init-file:
file.managed: file.managed:
{%- if salt['test.provider']('service') == 'systemd' %} {%- if salt['test.provider']('service') == 'systemd' %}
- source: salt://consul/files/consul.service - source: salt://{{ slspath }}/files/consul.service
- name: /etc/systemd/system/consul.service - name: /etc/systemd/system/consul.service
- mode: 0644 - mode: 0644
{%- elif salt['test.provider']('service') == 'upstart' %} {%- elif salt['test.provider']('service') == 'upstart' %}
- source: salt://consul/files/consul.upstart - source: salt://{{ slspath }}/files/consul.upstart
- name: /etc/init/consul.conf - name: /etc/init/consul.conf
- mode: 0644 - mode: 0644
{%- else %} {%- else %}
- source: salt://consul/files/consul.sysvinit - source: salt://{{ slspath }}/files/consul.sysvinit
- name: /etc/init.d/consul - name: /etc/init.d/consul
- mode: 0755 - mode: 0755
{%- endif %} {%- endif %}