2017-07-06 10:07:48 +02:00
|
|
|
---
|
2017-12-13 20:30:24 +01:00
|
|
|
- debug: msg="cli/basic.yaml on connection={{ ansible_connection }}"
|
|
|
|
|
2017-07-06 10:07:48 +02:00
|
|
|
- name: Remove linkagg
|
|
|
|
vyos_linkagg:
|
|
|
|
name: bond0
|
|
|
|
state: absent
|
|
|
|
|
2017-07-07 10:40:18 +02:00
|
|
|
- name: Remove linkagg
|
|
|
|
vyos_linkagg:
|
|
|
|
name: bond1
|
|
|
|
state: absent
|
|
|
|
|
2017-07-06 10:07:48 +02:00
|
|
|
- name: Create linkagg
|
|
|
|
vyos_linkagg:
|
|
|
|
name: bond0
|
|
|
|
members:
|
|
|
|
- eth1
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"set interfaces bonding bond0 mode 802.3ad" in result.commands'
|
|
|
|
- '"set interfaces ethernet eth1 bond-group bond0" in result.commands'
|
|
|
|
|
|
|
|
- name: Create linkagg again (idempotent)
|
|
|
|
vyos_linkagg:
|
|
|
|
name: bond0
|
|
|
|
members:
|
|
|
|
- eth1
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: Add linkagg member
|
|
|
|
vyos_linkagg:
|
|
|
|
name: bond0
|
|
|
|
members:
|
2017-07-07 10:40:18 +02:00
|
|
|
- eth2
|
2017-07-06 10:07:48 +02:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2017-07-07 10:40:18 +02:00
|
|
|
- '"set interfaces ethernet eth2 bond-group bond0" in result.commands'
|
2017-07-06 10:07:48 +02:00
|
|
|
|
|
|
|
- name: Add linkagg member again (idempotent)
|
|
|
|
vyos_linkagg:
|
|
|
|
name: bond0
|
|
|
|
members:
|
2017-07-07 10:40:18 +02:00
|
|
|
- eth2
|
2017-07-06 10:07:48 +02:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: Disable linkagg
|
|
|
|
vyos_linkagg:
|
|
|
|
name: bond0
|
|
|
|
state: down
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"set interfaces bonding bond0 disable" in result.commands'
|
|
|
|
|
|
|
|
- name: Disable linkagg again (idempotent)
|
|
|
|
vyos_linkagg:
|
|
|
|
name: bond0
|
|
|
|
state: down
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: Enable linkagg
|
|
|
|
vyos_linkagg:
|
|
|
|
name: bond0
|
|
|
|
state: up
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"delete interfaces bonding bond0 disable" in result.commands[0]'
|
|
|
|
|
|
|
|
- name: Enable linkagg again (idempotent)
|
|
|
|
vyos_linkagg:
|
|
|
|
name: bond0
|
|
|
|
state: up
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: Remove linkagg
|
|
|
|
vyos_linkagg:
|
|
|
|
name: bond0
|
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"delete interfaces ethernet eth1 bond-group" in result.commands'
|
|
|
|
- '"delete interfaces ethernet eth2 bond-group" in result.commands'
|
|
|
|
- '"delete interfaces bonding bond0" in result.commands'
|
|
|
|
|
|
|
|
- name: Remove linkagg again (idempotent)
|
|
|
|
vyos_linkagg:
|
|
|
|
name: bond0
|
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: Create collection of linkagg definitions
|
|
|
|
vyos_linkagg:
|
2017-07-26 16:09:17 +02:00
|
|
|
aggregate:
|
2019-12-03 15:34:35 +01:00
|
|
|
- {name: bond0, members: [eth1]}
|
|
|
|
- {name: bond1, members: [eth2]}
|
2017-07-06 10:07:48 +02:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"set interfaces bonding bond0 mode 802.3ad" in result.commands'
|
|
|
|
- '"set interfaces ethernet eth1 bond-group bond0" in result.commands'
|
|
|
|
- '"set interfaces bonding bond1 mode 802.3ad" in result.commands'
|
2017-07-07 10:40:18 +02:00
|
|
|
- '"set interfaces ethernet eth2 bond-group bond1" in result.commands'
|
2017-07-06 10:07:48 +02:00
|
|
|
|
|
|
|
- name: Create collection of linkagg definitions again (idempotent)
|
|
|
|
vyos_linkagg:
|
2017-07-26 16:09:17 +02:00
|
|
|
aggregate:
|
2019-12-03 15:34:35 +01:00
|
|
|
- {name: bond0, members: [eth1]}
|
|
|
|
- {name: bond1, members: [eth2]}
|
2017-07-06 10:07:48 +02:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: Remove collection of linkagg definitions
|
|
|
|
vyos_linkagg:
|
2017-07-26 16:09:17 +02:00
|
|
|
aggregate:
|
2017-08-15 15:39:44 +02:00
|
|
|
- name: bond0
|
|
|
|
- name: bond1
|
2017-07-06 10:07:48 +02:00
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"delete interfaces ethernet eth1 bond-group" in result.commands'
|
|
|
|
- '"delete interfaces bonding bond0" in result.commands'
|
|
|
|
- '"delete interfaces ethernet eth2 bond-group" in result.commands'
|
|
|
|
- '"delete interfaces bonding bond1" in result.commands'
|
|
|
|
|
|
|
|
- name: Remove collection of linkagg definitions again (idempotent)
|
|
|
|
vyos_linkagg:
|
2017-07-26 16:09:17 +02:00
|
|
|
aggregate:
|
2017-08-15 15:39:44 +02:00
|
|
|
- name: bond0
|
|
|
|
- name: bond1
|
2017-07-06 10:07:48 +02:00
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|