|
|
|
---
|
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_vpc sanity test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: enable feature vpc
|
|
|
|
nxos_feature:
|
|
|
|
feature: vpc
|
|
|
|
state: enabled
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
|
|
|
|
- name: Ensure ntc VRF exists on switch
|
|
|
|
nxos_vrf:
|
|
|
|
vrf: ntc
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
|
|
|
|
- name: Configure vpc
|
|
|
|
nxos_vpc: &conf_vpc
|
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
pkl_dest: 192.168.100.4
|
|
|
|
pkl_src: 10.1.100.20
|
|
|
|
pkl_vrf: ntc
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vpc: *conf_vpc
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Configure vpc1
|
|
|
|
nxos_vpc: &conf_vpc1
|
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
role_priority: 500
|
|
|
|
system_priority: 2000
|
|
|
|
peer_gw: True
|
|
|
|
delay_restore: 5
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vpc: *conf_vpc1
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Configure auto1
|
|
|
|
nxos_vpc: &auto_false
|
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
auto_recovery: False
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vpc: *auto_false
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Configure auto2
|
|
|
|
nxos_vpc: &auto_true
|
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
auto_recovery: True
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vpc: *auto_true
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
when: (platform is search("N7K|N9K-F"))
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Configure auto1
|
|
|
|
nxos_vpc: &auto_true1
|
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
auto_recovery: True
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vpc: *auto_true1
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Configure auto2
|
|
|
|
nxos_vpc: &auto_false1
|
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
auto_recovery: False
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vpc: *auto_false1
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
when: not (platform is search("N7K|N9K-F"))
|
|
|
|
|
|
|
|
- name: Configure vpc2
|
|
|
|
nxos_vpc: &conf_vpc2
|
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
role_priority: default
|
|
|
|
system_priority: default
|
|
|
|
peer_gw: True
|
|
|
|
delay_restore: default
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vpc: *conf_vpc2
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Configure vpc3
|
|
|
|
nxos_vpc: &conf_vpc3
|
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
peer_gw: False
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vpc: *conf_vpc3
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: remove vpc
|
|
|
|
nxos_vpc: &rem_vpc
|
|
|
|
state: absent
|
|
|
|
domain: 100
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Remove Idempotence"
|
|
|
|
nxos_vpc: *rem_vpc
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
always:
|
|
|
|
- name: remove vrf
|
|
|
|
nxos_vrf:
|
|
|
|
vrf: ntc
|
|
|
|
state: absent
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: disable feature vpc
|
|
|
|
nxos_feature:
|
|
|
|
feature: vpc
|
|
|
|
state: disabled
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_vpc sanity test"
|