add jinja files
This commit is contained in:
19
TP_03/templates/vlan_router.j2
Normal file
19
TP_03/templates/vlan_router.j2
Normal file
@@ -0,0 +1,19 @@
|
||||
{%- for interface in interfaces %}
|
||||
{%- if "g2/0" == interface.name %}
|
||||
interface {{ interface.name }}
|
||||
no shutdown
|
||||
exit
|
||||
|
||||
{%- elif "3/0" == interface.name %}
|
||||
interface {{ interface.name }}
|
||||
no shutdown
|
||||
exit
|
||||
|
||||
{%- else %}
|
||||
interface {{ interface.name }}
|
||||
encapsulation dot1Q {{interface.vlan_id}}
|
||||
description "{{ interface.description | default("**NO DESCRIPTION**") }}"
|
||||
ip address {{ interface.ip }} {{ interface.mask }}
|
||||
exit
|
||||
{% endif %}
|
||||
{%- endfor %}
|
||||
19
TP_03/templates/vlan_switch.j2
Normal file
19
TP_03/templates/vlan_switch.j2
Normal file
@@ -0,0 +1,19 @@
|
||||
{% for vlan in vlans %}
|
||||
vlan {{vlan.id}}
|
||||
name {{vlan.name}}
|
||||
exit
|
||||
{%- endfor %}
|
||||
{% for interface in interfaces %}
|
||||
{% if 'trunk' == interface.mode %}
|
||||
interface {{ interface.name }}
|
||||
switchport mode {{interface.mode}}
|
||||
switchport {{interface.mode}} allowed vlan {{interface.allowed_vlan}}
|
||||
exit
|
||||
{%- else %}
|
||||
interface {{ interface.name }}
|
||||
switchport mode {{interface.mode}}
|
||||
switchport {{interface.mode}} vlan {{interface.vlan_id}}
|
||||
description "{{ interface.description | default("**NO DESCRIPTION**") }}"
|
||||
exit
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
11
TP_03/templates/vrrp_router.j2
Normal file
11
TP_03/templates/vrrp_router.j2
Normal file
@@ -0,0 +1,11 @@
|
||||
{%- for interface in interfaces %}
|
||||
{% if 'g2/0' != interface.name and 'g3/0' != interface.name %}
|
||||
interface {{ interface.name }}
|
||||
vrrp {{interface.vrrp_id}} ip {{interface.vrrp_vip}}
|
||||
vrrp {{interface.vrrp_id}} priority {{interface.vrrp_priority}}
|
||||
{%- if 'master' == interface.vrrp_role %}
|
||||
vrrp {{interface.vrrp_id}} preempt
|
||||
exit
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
{%- endfor %}
|
||||
Reference in New Issue
Block a user