{% set tinc__tpl_services = [] %}
{% set tinc__tpl_existing_port = '655' %}
{% for key, network in tinc__combined_networks.items() %}
{%   if (network.port|d() and network.port != tinc__tpl_existing_port) %}
{%     set tinc__tpl_service = {
  "name": ('tinc-' + network.name | d(key)),
  "port": network.port,
  "protocols": [ 'tcp', 'udp' ],
  "comment": ('tinc ' + network.name | d(key) + ' VPN'),
  "state": (network.state|d("present"))
} %}
{%     set _ = tinc__tpl_services.append(tinc__tpl_service) %}
{%   endif %}
{% endfor %}
{{ tinc__tpl_services | to_yaml }}
