diff --git a/templates/config.hcl.j2 b/templates/config.hcl.j2 index f1f6019..6d3de8c 100644 --- a/templates/config.hcl.j2 +++ b/templates/config.hcl.j2 @@ -29,13 +29,13 @@ acl { } {% for server in _consul_lan_servers %} -{% set _ = consul_join.append(hostvars.server['consul_bind_address'] | default(hostvars[server]['ansible_default_ipv4']['address'],true) | mandatory) %} +{% 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']) %} + {% 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 %}