Compare commits
No commits in common. "master" and "devel" have entirely different histories.
13 changed files with 25 additions and 65 deletions
|
@ -12,7 +12,6 @@ consul-template-tmpl-file-{{ loop.index }}:
|
|||
file.managed:
|
||||
- source: {{ tmpl.source }}
|
||||
- name: /etc/consul-template/tmpl-source/{{ tmpl.name }}.ctmpl
|
||||
- template: {{ tmpl.template_engine }}
|
||||
|
||||
consul-template.d-tmpl-{{ loop.index }}:
|
||||
file.serialize:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
consul_template:
|
||||
version: 0.20.0
|
||||
hash: 500fe023c89517f959175eb79e21c33df0acf7733d3f3681ec8c5238863caf86
|
||||
version: 0.14.0
|
||||
hash: 7c70ea5f230a70c809333e75fdcff2f6f1e838f29cfb872e1420a63cdf7f3a78
|
||||
|
||||
service: false
|
||||
config:
|
||||
|
@ -9,7 +9,6 @@ consul_template:
|
|||
tmpl:
|
||||
- name: example
|
||||
source: salt://consul-template/files/example.ctmpl
|
||||
template_engine: null # None in Python
|
||||
config:
|
||||
template:
|
||||
source: /etc/consul-template/tmpl-source/example.ctmpl
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
[Unit]
|
||||
Description=consul-template
|
||||
Documentation=https://github.com/hashicorp/consul-template
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
Wants=network.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Environment="GOMAXPROCS=2" "PATH=/usr/local/bin:/usr/bin:/bin"
|
||||
ExecStart=/usr/local/bin/consul-template -config /etc/consul-template.d
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
KillMode=process
|
||||
KillSignal=SIGTERM
|
||||
Restart=on-failure
|
||||
RestartSec=42s
|
||||
KillSignal=TERM
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -20,7 +20,6 @@ consul-template-init-script:
|
|||
consul-template-service:
|
||||
service.running:
|
||||
- name: consul-template
|
||||
- enable: True
|
||||
- watch:
|
||||
- file: /etc/consul-template.d/*
|
||||
{% endif %}
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
consul-config:
|
||||
file.serialize:
|
||||
- name: /etc/consul.d/config.json
|
||||
- encoding: utf-8
|
||||
- formatter: json
|
||||
- dataset: {{ consul.config | json }}
|
||||
- dataset: {{ consul.config }}
|
||||
- user: {{ consul.user }}
|
||||
- group: {{ consul.group }}
|
||||
- mode: 0640
|
||||
|
@ -41,4 +40,4 @@ consul-script-config:
|
|||
- user: consul-user
|
||||
- formatter: json
|
||||
- dataset:
|
||||
services: {{ consul.register | json }}
|
||||
services: {{ consul.register }}
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
consul:
|
||||
version: 1.4.0
|
||||
version: 0.7.0
|
||||
download_host: releases.hashicorp.com
|
||||
bin_dir: /usr/local/bin
|
||||
|
||||
service: false
|
||||
|
||||
user: consul
|
||||
user_uid:
|
||||
group: consul
|
||||
group_gid:
|
||||
|
||||
ui_beta: false
|
||||
|
||||
config:
|
||||
server: false
|
||||
|
@ -17,7 +16,6 @@ consul:
|
|||
ui: true
|
||||
enable_debug: false
|
||||
log_level: info
|
||||
encrypt: ""
|
||||
retry_join: []
|
||||
retry_interval: 30s
|
||||
datacenter: "main"
|
||||
|
|
|
@ -1,20 +1,15 @@
|
|||
[Unit]
|
||||
Description="HashiCorp Consul - A service mesh solution"
|
||||
Documentation=https://www.consul.io/
|
||||
Requires=network-online.target
|
||||
After=network-online.target
|
||||
ConditionFileNotEmpty=/etc/consul.d/config.json
|
||||
Description=consul
|
||||
Wants=network.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/{% if grains['os_family'] == 'Debian' %}default{% else %}sysconfig{% endif %}/consul
|
||||
ExecStart=/usr/local/bin/consul agent -config-dir=/etc/consul.d
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
KillSignal=TERM
|
||||
User={{ user }}
|
||||
Group={{ group }}
|
||||
ExecStart={{ bin_dir }}/consul agent -config-dir=/etc/consul.d
|
||||
ExecReload={{ bin_dir }}/consul reload
|
||||
KillMode=process
|
||||
Restart=on-failure
|
||||
RestartSec=42s
|
||||
LimitNOFILE=65536
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
. /etc/rc.d/init.d/functions
|
||||
|
||||
prog="consul"
|
||||
exec="{{ bin_dir }}/$prog"
|
||||
exec="/usr/local/bin/$prog"
|
||||
pidfile="/var/run/$prog.pid"
|
||||
lockfile="/var/lock/subsys/$prog"
|
||||
logfile="/var/log/$prog"
|
||||
|
|
|
@ -18,7 +18,7 @@ script
|
|||
|
||||
exec start-stop-daemon --start \
|
||||
--chuid ${CONSUL_USER:-consul}:${CONSUL_GROUP:-consul} \
|
||||
--exec {{ bin_dir }}/consul agent -- \
|
||||
--exec /usr/local/bin/consul agent -- \
|
||||
-config-dir="/etc/consul.d" \
|
||||
${CONSUL_FLAGS} \
|
||||
>> /var/log/consul.log 2>&1
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
{%- if pillar.get('consul', {}).get('enabled', True) %}
|
||||
{% from slspath+"/map.jinja" import consul with context %}
|
||||
|
||||
include:
|
||||
- {{ slspath }}.install
|
||||
- {{ slspath }}.config
|
||||
- {{ slspath }}.service
|
||||
|
||||
{%- endif %}
|
|
@ -6,32 +6,22 @@ consul-dep-unzip:
|
|||
|
||||
consul-bin-dir:
|
||||
file.directory:
|
||||
- name: {{ consul.bin_dir }}
|
||||
- name: /usr/local/bin
|
||||
- makedirs: True
|
||||
|
||||
# Create consul user
|
||||
consul-group:
|
||||
group.present:
|
||||
- name: {{ consul.group }}
|
||||
- system: True
|
||||
{% if consul.get('group_gid', None) != None -%}
|
||||
- gid: {{ consul.group_gid }}
|
||||
{%- endif %}
|
||||
|
||||
consul-user:
|
||||
user.present:
|
||||
- name: {{ consul.user }}
|
||||
- groups:
|
||||
- {{ consul.group }}
|
||||
{% for groupname in consul.groups -%}
|
||||
- {{ groupname }}
|
||||
{%- endfor %}
|
||||
- home: {{ salt['user.info'](consul.user)['home']|default(consul.config.data_dir) }}
|
||||
- createhome: False
|
||||
- system: True
|
||||
{% if consul.get('user_uid', None) != None -%}
|
||||
- uid: {{ consul.user_uid }}
|
||||
{%- endif %}
|
||||
- require:
|
||||
- group: consul-group
|
||||
|
||||
|
@ -57,7 +47,7 @@ consul-download:
|
|||
- name: /tmp/consul_{{ consul.version }}_linux_{{ consul.arch }}.zip
|
||||
- source: https://{{ consul.download_host }}/consul/{{ consul.version }}/consul_{{ consul.version }}_linux_{{ consul.arch }}.zip
|
||||
- source_hash: https://releases.hashicorp.com/consul/{{ consul.version }}/consul_{{ consul.version }}_SHA256SUMS
|
||||
- unless: test -f {{ consul.bin_dir }}/consul-{{ consul.version }}
|
||||
- unless: test -f /usr/local/bin/consul-{{ consul.version }}
|
||||
|
||||
consul-extract:
|
||||
cmd.wait:
|
||||
|
@ -67,10 +57,10 @@ consul-extract:
|
|||
|
||||
consul-install:
|
||||
file.rename:
|
||||
- name: {{ consul.bin_dir }}/consul-{{ consul.version }}
|
||||
- name: /usr/local/bin/consul-{{ consul.version }}
|
||||
- source: /tmp/consul
|
||||
- require:
|
||||
- file: {{ consul.bin_dir }}
|
||||
- file: /usr/local/bin
|
||||
- watch:
|
||||
- cmd: consul-extract
|
||||
|
||||
|
@ -83,6 +73,6 @@ consul-clean:
|
|||
consul-link:
|
||||
file.symlink:
|
||||
- target: consul-{{ consul.version }}
|
||||
- name: {{ consul.bin_dir }}/consul
|
||||
- name: /usr/local/bin/consul
|
||||
- watch:
|
||||
- file: consul-install
|
||||
|
|
|
@ -14,31 +14,27 @@ consul-init-env:
|
|||
- contents:
|
||||
- CONSUL_USER={{ consul.user }}
|
||||
- CONSUL_GROUP={{ consul.group }}
|
||||
- CONSUL_UI_BETA={{ consul.ui_beta }}
|
||||
- GOMAXPROCS=2
|
||||
- PATH=/usr/local/bin:/usr/bin:/bin
|
||||
|
||||
consul-init-file:
|
||||
file.managed:
|
||||
{%- if salt['test.provider']('service').startswith('systemd') %}
|
||||
{%- if salt['test.provider']('service') == 'systemd' %}
|
||||
- source: salt://{{ slspath }}/files/consul.service
|
||||
- name: /etc/systemd/system/consul.service
|
||||
- template: jinja
|
||||
- context:
|
||||
user: {{ consul.user }}
|
||||
group: {{ consul.group }}
|
||||
bin_dir: {{ consul.bin_dir }}
|
||||
- mode: 0644
|
||||
{%- elif salt['test.provider']('service') == 'upstart' %}
|
||||
- source: salt://{{ slspath }}/files/consul.upstart
|
||||
- name: /etc/init/consul.conf
|
||||
- context:
|
||||
bin_dir: {{ consul.bin_dir }}
|
||||
- mode: 0644
|
||||
{%- else %}
|
||||
- source: salt://{{ slspath }}/files/consul.sysvinit
|
||||
- name: /etc/init.d/consul
|
||||
- context:
|
||||
bin_dir: {{ consul.bin_dir }}
|
||||
- mode: 0755
|
||||
{%- endif %}
|
||||
|
||||
|
|
|
@ -5,10 +5,6 @@ consul:
|
|||
# Set user and group for Consul config files and running service
|
||||
user: consul
|
||||
group: consul
|
||||
bin_dir: /opt/consul/bin
|
||||
|
||||
version: 0.7.0
|
||||
download_host: releases.hashicorp.com
|
||||
|
||||
config:
|
||||
server: True
|
||||
|
@ -26,10 +22,6 @@ consul:
|
|||
- 1.1.1.1
|
||||
- 2.2.2.2
|
||||
|
||||
ui: true
|
||||
log_level: info
|
||||
data_dir: /var/consul
|
||||
|
||||
register:
|
||||
- name: Redis
|
||||
checks:
|
||||
|
|
Loading…
Reference in a new issue