2017-10-26 15:27:55 +00:00
|
|
|
---
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_snapshot sanity test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-10-26 15:27:55 +00:00
|
|
|
|
|
|
|
- set_fact: snapshot_run="true"
|
|
|
|
- set_fact: snapshot_run="false"
|
2017-11-27 22:58:08 +00:00
|
|
|
when: titanium and ( connection.transport is match('nxapi'))
|
2017-10-26 15:27:55 +00:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: create snapshot
|
|
|
|
nxos_snapshot:
|
|
|
|
action: create
|
|
|
|
snapshot_name: test_snapshot1
|
|
|
|
description: Ansible
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
|
|
|
|
- name: create another snapshot
|
|
|
|
nxos_snapshot:
|
|
|
|
action: create
|
|
|
|
snapshot_name: test_snapshot2
|
|
|
|
description: row
|
|
|
|
section: myshow
|
|
|
|
show_command: show ip interface brief
|
|
|
|
row_id: ROW_intf
|
|
|
|
element_key1: intf-name
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
|
|
|
|
- name: compare snapshots
|
|
|
|
nxos_snapshot:
|
|
|
|
action: compare
|
|
|
|
snapshot1: test_snapshot1
|
|
|
|
snapshot2: test_snapshot2
|
|
|
|
comparison_results_file: compare_snapshots.txt
|
|
|
|
compare_option: summary
|
|
|
|
path: '.'
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
|
2018-03-29 12:47:32 +00:00
|
|
|
- name: FAIL compare snapshots
|
|
|
|
nxos_snapshot:
|
|
|
|
action: compare
|
|
|
|
snapshot1: test_snapshot1
|
|
|
|
snapshot2: test_snapshot2
|
|
|
|
compare_option: summary
|
|
|
|
path: '.'
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.failed == True'
|
|
|
|
- '"action is compare but all of the following are missing: comparison_results_file" in result.msg'
|
|
|
|
|
2017-10-26 15:27:55 +00:00
|
|
|
when: snapshot_run
|
|
|
|
|
|
|
|
always:
|
|
|
|
- name: delete snapshot
|
|
|
|
nxos_snapshot:
|
|
|
|
action: delete_all
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_snapshot sanity test"
|