I am trying to write switch port VLAN configuration and it breaks because of the last comma on the output, I am trying get an output as follows
vlan trunk allowed 2600,2610,2620,2630,2640,2650
but getting
vlan trunk allowed 2600,2610,2620,2630,2640,2650,
my code currently looks like this
{% for i in interfaces|default([]) %}
interface {{ i.port }}
no shutdown
mtu {{ mtu }}
description Link_to_{{ i.peer|lower }}
no routing
vlan trunk native 1
vlan trunk allowed {% for vc in vlans_core %}{% if vc.src == inventory_hostname and vc.dst == i.peer %}{{ vc.tag }},{% endif %}{% endfor %}{% for vc in vlans_core %}{% if vc.dst == inventory_hostname and vc.src == i.peer %}{{ vc.tag }},{% endif %}{% endfor %}
{% endfor %}
I tired the join but it only produced errors.
{{ vc.tag|join(", ") }}
I have also tried loop.last but this also didn't work
{% if not loop.last %},{% endif %}
Any help would be appreciated.