ansible-consul/templates/config.hcl.j2

42 lines
1.1 KiB
Plaintext
Raw Normal View History

2022-03-08 20:07:38 +00:00
bootstrap= {{consul_bootstrap|lower}}
server= {{consul_server|lower}}
2022-03-11 09:57:10 +00:00
bootstrap_expect= {{consul_bootstrap_expect}}
2022-03-08 20:07:38 +00:00
{% if consul_bind_address %}
bind_addr="{{consul_bind_address}}"
{% endif %}
{% if consul_client_addr %}
client_addr="{{consul_client_addr}}"
{% endif %}
{%if consul_ui %}
ui_config {
enabled = true
}
{%endif%}
{% if consul_gossip_encryption_key %}
encrypt= "{{consul_gossip_encryption_key}}"
{% endif %}
datacenter= "{{consul_datacenter}}"
data_dir= "{{consul_data_dir}}"
acl {
enabled = false
default_policy = "allow"
enable_token_persistence = true
}
{% for server in _consul_lan_servers %}
2022-03-11 09:57:10 +00:00
{% set _ = consul_join.append(hostvars.server['consul_bind_address'] | default(hostvars[server]['ansible_default_ipv4']['address'],true) | mandatory) %}
2022-03-08 20:07:38 +00:00
{% endfor %}
retry_join= {{ consul_join | map('ipwrap') | list | to_json }}
{% if _consul_wan_servercount | int > 0 %}
{% for server in _consul_wan_servers %}
{% set _ = consul_join_wan.append(hostvars[server]['consul_bind_address']) %}
{% endfor %}
retry_join_wan= {{ consul_join_wan | map('ipwrap') | list | to_json }}
{% endif %}