Skip to content

Instantly share code, notes, and snippets.

@Mierdin
Created February 16, 2015 19:14
Show Gist options
  • Save Mierdin/7843c3d48b8a3b185f5e to your computer and use it in GitHub Desktop.
Save Mierdin/7843c3d48b8a3b185f5e to your computer and use it in GitHub Desktop.
interfaces {
{%- for intf in interfaces %}
{{ intf }} {
{% set items = interfaces[intf] %}
{% set NEEDS_TAGGING = False %}
{% for i in items %}
{% if i.vlan != 0 %}
{% set NEEDS_TAGGING = True %}
{% endif %}
{% endfor %}
description "created by ansible";
{% if NEEDS_TAGGING == True %}vlan-tagging;{% endif %}
{% for i in items %}
unit {{ i.vlan }} {
description "vlan-{{ i.vlan }}";
{% if i.vlan != 0 %}vlan-id {{ i.vlan }};{% endif %}
family {
inet {
address {{ i.ip_addr }};
}
}
}
{% endfor %}
}
{%- endfor %}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment