mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
74 lines
1.5 KiB
YAML
74 lines
1.5 KiB
YAML
|
---
|
||
|
- name: setup - remove vlan used in test
|
||
|
vyos_config:
|
||
|
lines:
|
||
|
- delete interfaces ethernet eth1 vif 100
|
||
|
- delete interfaces ethernet eth0 vif 5
|
||
|
- delete interfaces ethernet eth0 vif 100
|
||
|
|
||
|
- name: set vlan with name
|
||
|
vyos_vlan: &name
|
||
|
vlan_id: 100
|
||
|
name: vlan-100
|
||
|
interfaces: eth1
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == true"
|
||
|
- "'set interfaces ethernet eth1 vif 100 description vlan-100' in result.commands"
|
||
|
|
||
|
- name: set vlan with name(idempotence)
|
||
|
vyos_vlan: *name
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == false"
|
||
|
|
||
|
- name: set vlan with address
|
||
|
vyos_vlan: &address
|
||
|
vlan_id: 5
|
||
|
address: 172.24.5.0/24
|
||
|
interfaces: eth0
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == true"
|
||
|
- "'set interfaces ethernet eth0 vif 5 address 172.24.5.0/24' in result.commands"
|
||
|
|
||
|
- name: set vlan with address(idempotence)
|
||
|
vyos_vlan: *address
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == false"
|
||
|
|
||
|
- name: delete
|
||
|
vyos_vlan: &delete
|
||
|
vlan_id: 100
|
||
|
interfaces: eth1
|
||
|
state: absent
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == true"
|
||
|
- "'delete interfaces ethernet eth1 vif 100' in result.commands"
|
||
|
|
||
|
- name: delete(idempotence)
|
||
|
vyos_vlan: *delete
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == false"
|
||
|
|
||
|
- name: teardown
|
||
|
vyos_config:
|
||
|
lines:
|
||
|
- delete interfaces ethernet eth1 vif 100
|
||
|
- delete interfaces ethernet eth0 vif 5
|