2017-08-15 16:08:55 +00:00
|
|
|
---
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_vpc sanity test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-08-15 16:08:55 +00:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: enable feature vpc
|
|
|
|
nxos_feature:
|
|
|
|
feature: vpc
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-15 16:08:55 +00:00
|
|
|
state: enabled
|
|
|
|
|
|
|
|
- name: Ensure ntc VRF exists on switch
|
|
|
|
nxos_vrf:
|
|
|
|
vrf: ntc
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-15 16:08:55 +00:00
|
|
|
|
|
|
|
- name: Configure vpc
|
|
|
|
nxos_vpc: &conf_vpc
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-15 16:08:55 +00:00
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
pkl_dest: 192.168.100.4
|
|
|
|
pkl_src: 10.1.100.20
|
|
|
|
pkl_vrf: ntc
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vpc: *conf_vpc
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
2018-02-08 13:20:37 +00:00
|
|
|
- name: Configure vpc1
|
|
|
|
nxos_vpc: &conf_vpc1
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2018-02-08 13:20:37 +00:00
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
role_priority: 500
|
|
|
|
system_priority: 2000
|
|
|
|
peer_gw: True
|
|
|
|
delay_restore: 5
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vpc: *conf_vpc1
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Configure auto1
|
|
|
|
nxos_vpc: &auto_false
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2018-02-08 13:20:37 +00:00
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
auto_recovery: False
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vpc: *auto_false
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Configure auto2
|
|
|
|
nxos_vpc: &auto_true
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2018-02-08 13:20:37 +00:00
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
auto_recovery: True
|
|
|
|
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
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2018-02-08 13:20:37 +00:00
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
auto_recovery: True
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vpc: *auto_true1
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Configure auto2
|
|
|
|
nxos_vpc: &auto_false1
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2018-02-08 13:20:37 +00:00
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
auto_recovery: False
|
|
|
|
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
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2018-02-08 13:20:37 +00:00
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
role_priority: default
|
|
|
|
system_priority: default
|
|
|
|
peer_gw: True
|
|
|
|
delay_restore: default
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vpc: *conf_vpc2
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Configure vpc3
|
|
|
|
nxos_vpc: &conf_vpc3
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2018-02-08 13:20:37 +00:00
|
|
|
state: present
|
|
|
|
domain: 100
|
|
|
|
peer_gw: False
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vpc: *conf_vpc3
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-08-15 16:08:55 +00:00
|
|
|
- name: remove vpc
|
|
|
|
nxos_vpc: &rem_vpc
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-15 16:08:55 +00:00
|
|
|
state: absent
|
|
|
|
domain: 100
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Remove Idempotence"
|
|
|
|
nxos_vpc: *rem_vpc
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
always:
|
|
|
|
- name: remove vrf
|
|
|
|
nxos_vrf:
|
|
|
|
vrf: ntc
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-15 16:08:55 +00:00
|
|
|
state: absent
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: disable feature vpc
|
|
|
|
nxos_feature:
|
|
|
|
feature: vpc
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-15 16:08:55 +00:00
|
|
|
state: disabled
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_vpc sanity test"
|