2017-07-27 15:32:35 +02:00
|
|
|
---
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_vrrp sanity test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-07-27 15:32:35 +02:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: "Enable interface-vlan"
|
|
|
|
nxos_feature:
|
|
|
|
feature: interface-vlan
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-07-27 15:32:35 +02:00
|
|
|
state: enabled
|
|
|
|
|
|
|
|
- name: "Enable vrrp"
|
|
|
|
nxos_feature:
|
|
|
|
feature: vrrp
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-07-27 15:32:35 +02:00
|
|
|
state: enabled
|
|
|
|
|
|
|
|
- name: "create int vlan 10"
|
2017-09-01 11:59:21 +02:00
|
|
|
nxos_config:
|
|
|
|
commands: "int vlan 10"
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-07-27 15:32:35 +02:00
|
|
|
|
|
|
|
- name: Ensure vrrp group 100 and vip 10.1.100.1 is on vlan10
|
2017-09-01 11:59:21 +02:00
|
|
|
nxos_vrrp: &configure
|
2017-07-27 15:32:35 +02:00
|
|
|
interface: vlan10
|
|
|
|
group: 100
|
|
|
|
vip: 10.1.100.1
|
2018-03-06 09:06:50 +01:00
|
|
|
admin_state: 'no shutdown'
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-09-01 11:59:21 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vrrp: *configure
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
2017-07-27 15:32:35 +02:00
|
|
|
|
2018-03-06 09:06:50 +01:00
|
|
|
- name: Ensure vrrp group 100 is default
|
|
|
|
nxos_vrrp: &configure_def
|
|
|
|
interface: vlan10
|
|
|
|
group: 100
|
|
|
|
vip: default
|
|
|
|
admin_state: default
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2018-03-06 09:06:50 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vrrp: *configure_def
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-07-27 15:32:35 +02:00
|
|
|
- name: Ensure removal of the vrrp group config
|
|
|
|
nxos_vrrp: &remove
|
|
|
|
interface: vlan10
|
|
|
|
group: 100
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-07-27 15:32:35 +02:00
|
|
|
state: absent
|
2017-09-01 11:59:21 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- pause:
|
|
|
|
seconds: 30
|
|
|
|
|
|
|
|
- name: "Remove Idempotence"
|
|
|
|
nxos_vrrp: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
2017-07-27 15:32:35 +02:00
|
|
|
|
|
|
|
- pause:
|
|
|
|
seconds: 30
|
|
|
|
|
|
|
|
- name: Re-config with more params
|
2017-09-01 11:59:21 +02:00
|
|
|
nxos_vrrp: &reconfig
|
2017-07-27 15:32:35 +02:00
|
|
|
interface: vlan10
|
|
|
|
group: 100
|
|
|
|
vip: 10.1.100.1
|
2018-03-06 09:06:50 +01:00
|
|
|
preempt: False
|
|
|
|
interval: 10
|
2017-07-27 15:32:35 +02:00
|
|
|
priority: 130
|
|
|
|
authentication: AUTHKEY
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-09-01 11:59:21 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Reconfig Idempotence"
|
|
|
|
nxos_vrrp: *reconfig
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
2017-07-27 15:32:35 +02:00
|
|
|
|
2018-03-06 09:06:50 +01:00
|
|
|
- name: Re-config with defaults
|
|
|
|
nxos_vrrp: &reconfig_def
|
|
|
|
interface: vlan10
|
|
|
|
group: 100
|
|
|
|
vip: default
|
|
|
|
preempt: True
|
|
|
|
interval: default
|
|
|
|
priority: default
|
|
|
|
authentication: default
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2018-03-06 09:06:50 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Reconfig Idempotence"
|
|
|
|
nxos_vrrp: *reconfig_def
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-07-27 15:32:35 +02:00
|
|
|
always:
|
|
|
|
- name: remove vrrp
|
|
|
|
nxos_vrrp: *remove
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: "Disable interface-vlan"
|
|
|
|
nxos_config:
|
|
|
|
commands:
|
|
|
|
- no feature interface-vlan
|
|
|
|
match: none
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-07-27 15:32:35 +02:00
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: "Disable vrrp"
|
|
|
|
nxos_feature:
|
|
|
|
feature: vrrp
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-07-27 15:32:35 +02:00
|
|
|
state: disabled
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_vrrp sanity test"
|