2017-07-28 19:06:41 +02:00
|
|
|
---
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_portchannel sanity test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-07-28 19:06:41 +02:00
|
|
|
|
|
|
|
- set_fact: testint1="{{ nxos_int1 }}"
|
|
|
|
- set_fact: testint2="{{ nxos_int2 }}"
|
|
|
|
|
|
|
|
- name: "Enable feature LACP"
|
|
|
|
nxos_feature:
|
|
|
|
feature: lacp
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-07-28 19:06:41 +02:00
|
|
|
state: enabled
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: "Put interface {{testint1}} into default state"
|
|
|
|
nxos_config: &intdefault1
|
|
|
|
lines:
|
|
|
|
- "default interface {{ testint1 }}"
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-07-28 19:06:41 +02:00
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: "Put interface {{testint2}} into default state"
|
|
|
|
nxos_config: &intdefault2
|
|
|
|
lines:
|
|
|
|
- "default interface {{ testint2 }}"
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-07-28 19:06:41 +02:00
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: Remove possibly configured port-channel 99
|
|
|
|
nxos_portchannel: &delpc
|
|
|
|
group: 99
|
|
|
|
members: ["{{ testint1 }}", "{{ testint2 }}"]
|
|
|
|
force: 'true'
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-07-28 19:06:41 +02:00
|
|
|
state: absent
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Configure port-channel mode active
|
|
|
|
nxos_portchannel: &configpc
|
|
|
|
group: 99
|
|
|
|
members: ["{{ testint1 }}", "{{ testint2 }}"]
|
|
|
|
mode: active
|
|
|
|
force: 'true'
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-07-28 19:06:41 +02:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: Check Idempotence
|
|
|
|
nxos_portchannel: *configpc
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Configure port-channel mode passive
|
|
|
|
nxos_portchannel: &configpcpassive
|
|
|
|
group: 99
|
|
|
|
members: ["{{ testint1 }}", "{{ testint2 }}"]
|
|
|
|
mode: passive
|
|
|
|
force: 'true'
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-07-28 19:06:41 +02:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: Check Idempotence
|
|
|
|
nxos_portchannel: *configpcpassive
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Configure port-channel
|
|
|
|
nxos_portchannel: *delpc
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
rescue:
|
|
|
|
- name: "Disable feature LACP"
|
|
|
|
nxos_feature:
|
|
|
|
feature: lacp
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-07-28 19:06:41 +02:00
|
|
|
state: disabled
|
|
|
|
|
|
|
|
always:
|
|
|
|
- name: Delete port-channel
|
|
|
|
nxos_portchannel: *delpc
|
|
|
|
register: result
|
|
|
|
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_portchannel sanity test"
|