summaryrefslogtreecommitdiff
path: root/roles/dellos6
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2019-06-22 09:13:20 +0200
committerChristian Pointner <equinox@spreadspace.org>2019-06-22 09:13:20 +0200
commit0bd99aef082b556a982a7920af15e6b5a02bc7d6 (patch)
treed8a1a2a84a2ea8214592b029820e4440e2611f6b /roles/dellos6
parentdellos: basic vlan management (diff)
dellos6: basic interface manangement
Diffstat (limited to 'roles/dellos6')
-rw-r--r--roles/dellos6/layer2/tasks/main.yml16
-rw-r--r--roles/dellos6/layer2/templates/interfaces.j234
-rw-r--r--roles/dellos6/layer2/templates/vlans.j2 (renamed from roles/dellos6/layer2/templates/vlan.j2)0
3 files changed, 47 insertions, 3 deletions
diff --git a/roles/dellos6/layer2/tasks/main.yml b/roles/dellos6/layer2/tasks/main.yml
index 75617b1c..a9383e5f 100644
--- a/roles/dellos6/layer2/tasks/main.yml
+++ b/roles/dellos6/layer2/tasks/main.yml
@@ -1,6 +1,16 @@
---
-- name: create vlans
+# - name: configure vlans
+# dellos6_config:
+# src: vlans.j2
+# replace: block
+# notify: save configuration
+
+- pause:
+ prompt: "\n\n{{ lookup('template', 'interfaces.j2') }}\n\n"
+ delegate_to: localhost
+
+- name: configure interfaces
dellos6_config:
- src: vlan.j2
+ src: interfaces.j2
+ replace: block
notify: save configuration
- register: vlan_result
diff --git a/roles/dellos6/layer2/templates/interfaces.j2 b/roles/dellos6/layer2/templates/interfaces.j2
new file mode 100644
index 00000000..28ec1341
--- /dev/null
+++ b/roles/dellos6/layer2/templates/interfaces.j2
@@ -0,0 +1,34 @@
+{% for interface in dellos6_interfaces %}
+interface {{ interface.spec }}
+{% if 'description' in interface %}
+description "{{ interface.description }}"
+{% endif %}
+{% if 'channel_group' in interface %}
+channel-group {{ interface.channel_group }} mode active
+{% endif %}
+switchport mode {{ interface.switchport_mode | default('access') }}
+{% if 'switchport_mode' not in interface or interface.switchport_mode == 'access' %}
+{% if 'vlan' in interface %}
+switchport access vlan {{ interface.vlan }}
+{% endif %}
+{% elif interface.switchport_mode == 'trunk' %}
+{% if 'pvid' in interface %}
+switchport trunk native vlan {{ interface.pvid }}
+{% endif %}
+{% elif interface.switchport_mode == 'general' %}
+{% if 'tagged_only' in interface and interface.tagged_only %}
+switchport general acceptable-frame-type tagged-only
+{% endif %}
+{% if 'ingress_filtering' in interface and not interface.ingress_filtering %}
+switchport general ingress-filtering disable
+{% endif %}
+{% if 'forbidden_vlans' in interface %}
+switchport general forbidden vlan add {{ interface.forbidden_vlans | join(',') }}
+{% endif %}
+switchport general allowed vlan add {{ interface.allowed_vlans | join(',') }}
+{% if 'pvid' in interface %}
+switchport general pvid {{ interface.pvid }}
+{% endif %}
+{% endif %}
+exit
+{% endfor %}
diff --git a/roles/dellos6/layer2/templates/vlan.j2 b/roles/dellos6/layer2/templates/vlans.j2
index 6403c735..6403c735 100644
--- a/roles/dellos6/layer2/templates/vlan.j2
+++ b/roles/dellos6/layer2/templates/vlans.j2