Make config generic

This commit is contained in:
Bahadır Kandemir 2015-10-07 22:02:53 +03:00
parent cabb7cc309
commit 767274fd64
6 changed files with 19 additions and 40 deletions

View File

@ -1,7 +1,10 @@
consul:
server: false
client: false
service: false
token: ""
bootstrap: 1
datacenter: "main"
config:
server: false
bind_addr: 0.0.0.0
data_dir: /var/consul
ui_dir: /opt/consul/dist
enable_debug: false
log_level: info
encrypt: ""

View File

@ -1,7 +0,0 @@
{
"data_dir": "/var/consul",
"ui_dir": "/opt/consul/dist",
"enable_debug": true,
"log_level": "info",
"encrypt": "{{ salt['pillar.get']('consul:token') }}"
}

2
consul/files/config.json Normal file
View File

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

View File

@ -1,5 +0,0 @@
{
"server": true,
"bootstrap_expect": {{ salt['pillar.get']('consul:bootstrap') }},
"datacenter": "{{ salt['pillar.get']('consul:datacenter') }}"
}

View File

@ -63,11 +63,11 @@ consul_data_dir:
- user: consul
- group: consul
consul_common_config:
consul_config:
file.managed:
- source: salt://consul/files/common.json
- source: salt://consul/files/config.json
- template: jinja
- name: /etc/consul.d/common.json
- name: /etc/consul.d/config.json
{% if consul.service != False %}
- watch_in:
- service: consul
@ -77,22 +77,6 @@ consul_common_config:
- require:
- user: consul
{% if consul.server != False %}
consul_server_config:
file.managed:
- source: salt://consul/files/server.json
- name: /etc/consul.d/server.json
- template: jinja
{% if consul.service != False %}
- watch_in:
- service: consul
{% endif %}
- user: consul
- group: consul
- require:
- user: consul
{% endif %}
{% if consul.service != False %}
consul_service:
service.running:

View File

@ -1,6 +1,8 @@
consul:
server: true
service: true
token: "RIxqpNlOXqtr/j4BgvIMEw=="
bootstrap: 3
datacenter: "eu"
config:
server: true
encrypt: "RIxqpNlOXqtr/j4BgvIMEw=="
bootstrap: 3
datacenter: eu
bind_addr: 0.0.0.0