Ajout TP-02

This commit is contained in:
2025-11-13 09:34:59 +01:00
parent 5c7fa4d11a
commit ef4dffe5ef
11 changed files with 279 additions and 13 deletions

View File

@@ -1,5 +0,0 @@
# TEMPLATES
**This directory is required.**
The templates directory contains your jinja.j2 files.

View File

@@ -0,0 +1,9 @@
hostname {{ hostname }}
{% for interface in interfaces %}
interface {{ interface.name }}
description {{ interface.description }}
ip address {{ interface.ip }} {{ interface.mask }}
encapsulation dot1Q {{ interface.vlan_id }}
no shutdown
{% endfor %}
end

View File

@@ -0,0 +1,22 @@
hostname {{ hostname }}
! Configuration des interfaces
{% for interface in interfaces %}
interface {{ interface.name }}
description {{ interface.description }}
{% if interface.mode == "access" %}
switchport mode access
switchport access vlan {{ interface.vlan_id }}
{% elif interface.mode == "trunk" %}
switchport mode trunk
switchport trunk allowed vlan add {{ interface.vlan_id }}
{% endif %}
no shutdown
{% endfor %}
{% if management is defined %}
! Configuration de l'IP de management
interface vlan {{ management.vlan }}
ip address {{ management.ip_address }} {{ management.subnet }}
no shutdown
{% endif %}
end