mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-07-27 00:05:44 +02:00
Update to 2022-08-01 16:00
This commit is contained in:
47
roles/consul/templates/consul.hcl.j2
Normal file
47
roles/consul/templates/consul.hcl.j2
Normal file
@@ -0,0 +1,47 @@
|
||||
data_dir = "{{ consul_root_dir }}/data"
|
||||
log_level = "{{ consul_conf.log_level }}"
|
||||
bind_addr = "0.0.0.0"
|
||||
client_addr = "0.0.0.0"
|
||||
|
||||
advertise_addr = "{{ consul_conf.advertise_addr }}"
|
||||
|
||||
{% if consul_conf.datacenter is defined %}
|
||||
datacenter = "{{ consul_conf.datacenter }}"
|
||||
{% endif %}
|
||||
|
||||
{% if consul_conf.node_name is defined %}
|
||||
node_name = {{ consul_conf.node_name }}
|
||||
{% endif %}
|
||||
|
||||
ports {
|
||||
{% for service in consul_services.keys() | list %}
|
||||
{% if service not in ['sidecar', 'expose'] and consul_services[service].port is defined %}
|
||||
{{ service }} = {{ consul_services[service].port }}
|
||||
{% elif service in ['sidecar', 'expose'] %}
|
||||
{{ service }}_min_port = {{ consul_services[service].port | split(':') | first }}
|
||||
{{ service }}_max_port = {{ consul_services[service].port | split(':') | last }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
}
|
||||
|
||||
bootstrap_expect = {{ consul_conf.bootstrap_expect }}
|
||||
|
||||
performance {
|
||||
raft_multiplier = {{ consul_conf.performance.raft_multiplier }}
|
||||
}
|
||||
|
||||
retry_join = [
|
||||
{% for server in consul_servers %}
|
||||
"{{ server }}",
|
||||
{% endfor %}
|
||||
]
|
||||
|
||||
server = {{ consul_conf.server | ternary('true', 'false') }}
|
||||
|
||||
{% if consul_conf.encrypt is defined %}
|
||||
encrypt = "{{ consul_conf.encrypt }}"
|
||||
{% endif %}
|
||||
|
||||
ui_config {
|
||||
enabled = {{ consul_conf.ui_config.enabled | ternary('true', 'false') }}
|
||||
}
|
@@ -1 +0,0 @@
|
||||
{{ consul_conf | to_nice_json(indent=2) }}
|
@@ -3,17 +3,18 @@ Description="HashiCorp Consul - A service mesh solution"
|
||||
Documentation=https://www.consul.io/
|
||||
Requires=network-online.target
|
||||
After=network-online.target
|
||||
ConditionFileNotEmpty={{ consul_root_dir }}/etc/consul.json
|
||||
ConditionFileNotEmpty={{ consul_root_dir }}/etc/consul.hcl
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-{{ consul_root_dir }}/etc/consul.env
|
||||
User={{ consul_user }}
|
||||
Group={{ consul_user }}
|
||||
ExecStart={{ consul_root_dir }}/bin/consul agent -config-dir={{ consul_root_dir }}/etc/
|
||||
ExecStart={{ consul_root_dir }}/bin/consul agent -config-file={{ consul_root_dir }}/etc/consul.hcl
|
||||
ExecReload=/bin/kill --signal HUP $MAINPID
|
||||
KillMode=process
|
||||
KillSignal=SIGTERM
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
LimitNOFILE=65536
|
||||
|
||||
[Install]
|
||||
|
Reference in New Issue
Block a user