ansible-consul/templates/config.json.j2
2022-06-06 16:04:47 +02:00

49 lines
1.4 KiB
Django/Jinja

{
"bootstrap": {{consul_bootstrap|lower}},
"server": {{consul_server|lower}},
{% if consul_server %}
"bootstrap_expect": {{consul_bootstrap_expect}},
{% endif %}
"domain": "{{consul_domain}}",
{% if consul_bind_address %}
"bind_addr":"{{consul_bind_address}}",
{% endif %}
{% if consul_client_addr %}
"client_addr":"{{consul_client_addr}}",
{% endif %}
{% if consul_raw_key %}
"encrypt": "{{consul_raw_key}}",
{% endif %}
"datacenter": "{{consul_datacenter}}",
"data_dir": "{{consul_data_dir}}",
"acl": {
"enabled": false,
"default_policy": "allow",
"enable_token_persistence": true
},
{%if consul_retry_join_force %}
{% for server in consul_retry_join_force %}
{% set _ = consul_join.append(server) %}
{% endfor %}
{% else %}
{% for server in _consul_lan_servers %}
{% set _ = consul_join.append(hostvars[server]['consul_bind_address'] | default(hostvars[server]['ansible_default_ipv4']['address'],true) | mandatory) %}
{% endfor %}
{% endif %}
"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']|default(hostvars[server]['ansible_default_ipv4']['address'],true) | mandatory) %}
{% endfor %}
"retry_join_wan": {{ consul_join_wan | map('ipwrap') | list | to_json }},
{% endif %}
"ui_config": {
"enabled": {{consul_ui|bool|to_json}}
}
}