mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.6 KiB
YAML
64 lines
1.6 KiB
YAML
5 years ago
|
---
|
||
|
- debug:
|
||
|
msg: "Start nxos_interfaces overridden integration tests connection={{ ansible_connection }}"
|
||
|
|
||
|
- set_fact: test_int1="{{ nxos_int1 }}"
|
||
|
- set_fact: test_int2="{{ nxos_int2 }}"
|
||
|
|
||
|
- name: setup1
|
||
|
cli_config: &cleanup
|
||
|
config: |
|
||
|
default interface {{ test_int1 }}
|
||
|
default interface {{ test_int2 }}
|
||
|
|
||
|
- block:
|
||
|
- name: setup2
|
||
|
cli_config:
|
||
|
config: |
|
||
|
interface {{ test_int1 }}
|
||
|
shutdown
|
||
|
|
||
|
- name: Gather interfaces facts
|
||
|
nxos_facts: &facts
|
||
|
gather_subset:
|
||
|
- '!all'
|
||
|
- '!min'
|
||
|
gather_network_resources: interfaces
|
||
|
|
||
|
- name: Overridden
|
||
|
nxos_interfaces: &overridden
|
||
|
config:
|
||
|
- name: "{{ test_int2 }}"
|
||
|
description: Configured by Ansible
|
||
|
state: overridden
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "ansible_facts.network_resources.interfaces|symmetric_difference(result.before)|length == 0"
|
||
|
- "result.changed == true"
|
||
|
- "'interface {{ test_int1 }}' in result.commands"
|
||
|
- "'no shutdown' in result.commands"
|
||
|
- "'interface {{ test_int2 }}' in result.commands"
|
||
|
- "'description Configured by Ansible' in result.commands"
|
||
|
|
||
|
- name: Gather interfaces post facts
|
||
|
nxos_facts: *facts
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "ansible_facts.network_resources.interfaces|symmetric_difference(result.after)|length == 0"
|
||
|
|
||
|
- name: Idempotence - Overridden
|
||
|
nxos_interfaces: *overridden
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == false"
|
||
|
- "result.commands|length == 0"
|
||
|
|
||
|
always:
|
||
|
- name: teardown
|
||
|
cli_config: *cleanup
|