2017-10-27 11:51:37 +02:00
|
|
|
---
|
2017-12-13 20:30:24 +01:00
|
|
|
- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"
|
|
|
|
|
2017-10-27 11:51:37 +02:00
|
|
|
- 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
|
2018-06-19 15:20:28 +02:00
|
|
|
- delete interfaces ethernet eth0 vif 101
|
|
|
|
- delete interfaces ethernet eth1 vif 201
|
2017-10-27 11:51:37 +02:00
|
|
|
|
|
|
|
- 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
|
2017-10-28 06:35:29 +02:00
|
|
|
address: 192.168.5.12/24
|
2017-10-27 11:51:37 +02:00
|
|
|
interfaces: eth0
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-10-28 06:35:29 +02:00
|
|
|
- "'set interfaces ethernet eth0 vif 5 address 192.168.5.12/24' in result.commands"
|
2017-10-27 11:51:37 +02:00
|
|
|
|
|
|
|
- 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"
|
|
|
|
|
2018-06-19 15:20:28 +02:00
|
|
|
- name: Create VLANs using aggregate
|
|
|
|
vyos_vlan: &agg_vlan
|
|
|
|
aggregate:
|
2019-12-03 15:34:35 +01:00
|
|
|
- {vlan_id: 101, name: voice, interfaces: "eth0"}
|
|
|
|
- {vlan_id: 201, name: mgm, interfaces: "eth1"}
|
2018-06-19 15:20:28 +02:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'set interfaces ethernet eth0 vif 101 description voice' in result.commands"
|
|
|
|
- "'set interfaces ethernet eth1 vif 201 description mgm' in result.commands"
|
|
|
|
|
|
|
|
- name: Create VLANs using aggregate (idempotent)
|
|
|
|
vyos_vlan: *agg_vlan
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
2017-10-27 11:51:37 +02:00
|
|
|
- name: teardown
|
|
|
|
vyos_config:
|
|
|
|
lines:
|
|
|
|
- delete interfaces ethernet eth1 vif 100
|
|
|
|
- delete interfaces ethernet eth0 vif 5
|
2018-06-19 15:20:28 +02:00
|
|
|
- delete interfaces ethernet eth0 vif 101
|
|
|
|
- delete interfaces ethernet eth1 vif 201
|