ansible-consul/templates/config.json.j2

49 lines
1.4 KiB
Plaintext
Raw Normal View History

2022-06-06 14:04:47 +00:00
{
"bootstrap": {{consul_bootstrap|lower}},
"server": {{consul_server|lower}},
2022-04-03 18:39:52 +00:00
{% if consul_server %}
2022-06-06 14:04:47 +00:00
"bootstrap_expect": {{consul_bootstrap_expect}},
2022-04-03 18:39:52 +00:00
{% endif %}
2022-06-06 14:04:47 +00:00
"domain": "{{consul_domain}}",
2022-03-08 20:07:38 +00:00
{% if consul_bind_address %}
2022-06-06 14:04:47 +00:00
"bind_addr":"{{consul_bind_address}}",
2022-03-08 20:07:38 +00:00
{% endif %}
{% if consul_client_addr %}
2022-06-06 14:04:47 +00:00
"client_addr":"{{consul_client_addr}}",
2022-03-08 20:07:38 +00:00
{% endif %}
2022-06-06 14:04:47 +00:00
{% if consul_raw_key %}
"encrypt": "{{consul_raw_key}}",
2022-03-08 20:07:38 +00:00
{% endif %}
2022-06-06 14:04:47 +00:00
"datacenter": "{{consul_datacenter}}",
"data_dir": "{{consul_data_dir}}",
"acl": {
"enabled": false,
"default_policy": "allow",
"enable_token_persistence": true
},
2022-04-03 18:39:52 +00:00
{%if consul_retry_join_force %}
{% for server in consul_retry_join_force %}
{% set _ = consul_join.append(server) %}
{% endfor %}
{% else %}
2022-03-08 20:07:38 +00:00
{% for server in _consul_lan_servers %}
2022-03-12 10:16:39 +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 %}
2022-04-03 18:39:52 +00:00
{% endif %}
2022-06-06 14:04:47 +00:00
"retry_join": {{ consul_join | map('ipwrap') | list | to_json }},
2022-03-08 20:07:38 +00:00
{% if _consul_wan_servercount | int > 0 %}
{% for server in _consul_wan_servers %}
2022-03-12 10:16:39 +00:00
{% set _ = consul_join_wan.append(hostvars[server]['consul_bind_address']|default(hostvars[server]['ansible_default_ipv4']['address'],true) | mandatory) %}
2022-03-08 20:07:38 +00:00
{% endfor %}
2022-06-06 14:04:47 +00:00
"retry_join_wan": {{ consul_join_wan | map('ipwrap') | list | to_json }},
2022-03-08 20:07:38 +00:00
{% endif %}
2022-06-06 14:04:47 +00:00
"ui_config": {
"enabled": {{consul_ui|bool|to_json}}
}
}