2018-01-22 20:00:39 +01:00
|
|
|
---
|
2019-05-17 19:06:27 +02:00
|
|
|
- debug:
|
|
|
|
msg: "START eos_l2_interface cli/basic.yaml on connection={{ ansible_connection }}"
|
2018-01-22 20:00:39 +01:00
|
|
|
|
|
|
|
- name: Delete test interface switchports
|
2019-05-17 19:06:27 +02:00
|
|
|
eos_l2_interface: &clear
|
2018-01-22 20:00:39 +01:00
|
|
|
name: Ethernet1
|
|
|
|
state: absent
|
2018-01-23 21:30:03 +01:00
|
|
|
become: yes
|
2018-01-22 20:00:39 +01:00
|
|
|
|
|
|
|
- name: Set switchport mode to access on vlan 4000
|
2019-05-17 19:06:27 +02:00
|
|
|
eos_l2_interface: &vlan-4000
|
2018-01-22 20:00:39 +01:00
|
|
|
name: Ethernet1
|
|
|
|
state: present
|
|
|
|
mode: access
|
|
|
|
access_vlan: 4000
|
|
|
|
become: yes
|
|
|
|
register: result
|
|
|
|
|
2019-05-17 19:06:27 +02:00
|
|
|
- assert: &changed
|
2018-01-22 20:00:39 +01:00
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
|
|
|
|
- name: Set switchport mode to access on vlan 4000 again (idempotent)
|
2019-05-17 19:06:27 +02:00
|
|
|
eos_l2_interface: *vlan-4000
|
2018-01-22 20:00:39 +01:00
|
|
|
become: yes
|
|
|
|
register: result
|
|
|
|
|
2019-05-17 19:06:27 +02:00
|
|
|
- assert: &unchanged
|
2018-01-22 20:00:39 +01:00
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: Change access vlan to 4001
|
2019-05-17 19:06:27 +02:00
|
|
|
eos_l2_interface: &vlan-4001
|
2018-01-22 20:00:39 +01:00
|
|
|
name: Ethernet1
|
|
|
|
state: present
|
|
|
|
mode: access
|
|
|
|
access_vlan: 4001
|
|
|
|
become: yes
|
|
|
|
register: result
|
|
|
|
|
2019-05-17 19:06:27 +02:00
|
|
|
- assert: *changed
|
2018-01-22 20:00:39 +01:00
|
|
|
|
|
|
|
- name: Change access vlan to 4001 again (idempotent)
|
2019-05-17 19:06:27 +02:00
|
|
|
eos_l2_interface: *vlan-4001
|
|
|
|
become: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *unchanged
|
|
|
|
|
|
|
|
- name: Change switchport mode to trunk
|
|
|
|
eos_l2_interface: &trunk
|
2018-01-22 20:00:39 +01:00
|
|
|
name: Ethernet1
|
|
|
|
state: present
|
2019-05-17 19:06:27 +02:00
|
|
|
mode: trunk
|
2018-01-22 20:00:39 +01:00
|
|
|
become: yes
|
|
|
|
register: result
|
|
|
|
|
2019-05-17 19:06:27 +02:00
|
|
|
- assert: *changed
|
|
|
|
|
|
|
|
- name: Change switchport mode to trunk (idempotent)
|
|
|
|
eos_l2_interface: *trunk
|
|
|
|
become: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *unchanged
|
2018-01-22 20:00:39 +01:00
|
|
|
|
|
|
|
- name: Change switchport mode to trunk and set native vlan to 4001
|
2019-05-17 19:06:27 +02:00
|
|
|
eos_l2_interface: &trunk-native
|
2018-01-22 20:00:39 +01:00
|
|
|
name: Ethernet1
|
|
|
|
state: present
|
|
|
|
mode: trunk
|
|
|
|
native_vlan: 4001
|
|
|
|
become: yes
|
|
|
|
register: result
|
|
|
|
|
2019-05-17 19:06:27 +02:00
|
|
|
- assert: *changed
|
2018-01-22 20:00:39 +01:00
|
|
|
|
|
|
|
- name: Change switchport mode to trunk and set native vlan to 4001 again (idempotent)
|
2019-05-17 19:06:27 +02:00
|
|
|
eos_l2_interface: *trunk-native
|
2018-01-22 20:00:39 +01:00
|
|
|
become: yes
|
|
|
|
register: result
|
|
|
|
|
2019-05-17 19:06:27 +02:00
|
|
|
- assert: *unchanged
|
2018-01-22 20:00:39 +01:00
|
|
|
|
|
|
|
- name: Set trunk allowed vlans to 20 and 4000
|
2019-05-17 19:06:27 +02:00
|
|
|
eos_l2_interface: &trunk-allowed
|
2018-01-22 20:00:39 +01:00
|
|
|
name: Ethernet1
|
|
|
|
state: present
|
|
|
|
mode: trunk
|
|
|
|
trunk_allowed_vlans: 20,4000
|
|
|
|
become: yes
|
|
|
|
register: result
|
|
|
|
|
2019-05-17 19:06:27 +02:00
|
|
|
- assert: *changed
|
2018-01-22 20:00:39 +01:00
|
|
|
|
|
|
|
- name: Set trunk allowed vlans to 20 and 4000 again (idempotent)
|
2019-05-17 19:06:27 +02:00
|
|
|
eos_l2_interface: *trunk-allowed
|
2018-01-22 20:00:39 +01:00
|
|
|
become: yes
|
|
|
|
register: result
|
|
|
|
|
2019-05-17 19:06:27 +02:00
|
|
|
- assert: *unchanged
|
2018-01-22 20:00:39 +01:00
|
|
|
|
|
|
|
- name: Tear down switchports
|
2019-05-17 19:06:27 +02:00
|
|
|
eos_l2_interface: *clear
|
2018-01-22 20:00:39 +01:00
|
|
|
become: yes
|
|
|
|
|
2019-05-17 19:06:27 +02:00
|
|
|
- debug: msg="END eos_l2_interface cli/basic.yaml on connection={{ ansible_connection }}"
|