bootstrap= {{consul_bootstrap|lower}} server= {{consul_server|lower}} {% 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 %} {% set _ = consul_join.append(hostvars[server]['consul_bind_address'] | default(hostvars[server]['ansible_default_ipv4']['address'],true) | mandatory) %} {% 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 %}