|
|
@ -4,19 +4,61 @@
|
|
|
|
when: ansible_connection == "local"
|
|
|
|
when: ansible_connection == "local"
|
|
|
|
|
|
|
|
|
|
|
|
- set_fact: snapshot_run="true"
|
|
|
|
- set_fact: snapshot_run="true"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- set_fact: snapshot_run="false"
|
|
|
|
|
|
|
|
when: titanium and (ansible_connection is match('nxapi'))
|
|
|
|
|
|
|
|
|
|
|
|
- set_fact: snapshot_run="false"
|
|
|
|
- set_fact: snapshot_run="false"
|
|
|
|
when: titanium and ( connection.transport is match('nxapi'))
|
|
|
|
when: platform is match('N35')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- set_fact: add_sec="true"
|
|
|
|
|
|
|
|
- set_fact: add_sec="false"
|
|
|
|
|
|
|
|
when: imagetag is search("D1")
|
|
|
|
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- block:
|
|
|
|
- name: create snapshot
|
|
|
|
- name: create snapshot
|
|
|
|
nxos_snapshot:
|
|
|
|
nxos_snapshot: &crss1
|
|
|
|
action: create
|
|
|
|
action: create
|
|
|
|
snapshot_name: test_snapshot1
|
|
|
|
snapshot_name: test_snapshot1
|
|
|
|
description: Ansible
|
|
|
|
description: Ansible
|
|
|
|
save_snapshot_locally: true
|
|
|
|
save_snapshot_locally: True
|
|
|
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
|
|
|
|
that:
|
|
|
|
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
|
|
|
|
nxos_snapshot: *crss1
|
|
|
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
|
|
|
|
that:
|
|
|
|
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- block:
|
|
|
|
|
|
|
|
- name: Add section
|
|
|
|
|
|
|
|
nxos_snapshot: &add
|
|
|
|
|
|
|
|
action: add
|
|
|
|
|
|
|
|
section: myshow
|
|
|
|
|
|
|
|
show_command: show ip interface brief
|
|
|
|
|
|
|
|
row_id: ROW_intf
|
|
|
|
|
|
|
|
element_key1: intf-name
|
|
|
|
|
|
|
|
element_key2: intf-name
|
|
|
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
|
|
|
|
nxos_snapshot: *add
|
|
|
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
when: add_sec
|
|
|
|
|
|
|
|
|
|
|
|
- name: create another snapshot
|
|
|
|
- name: create another snapshot
|
|
|
|
nxos_snapshot:
|
|
|
|
nxos_snapshot: &crss2
|
|
|
|
action: create
|
|
|
|
action: create
|
|
|
|
snapshot_name: test_snapshot2
|
|
|
|
snapshot_name: test_snapshot2
|
|
|
|
description: row
|
|
|
|
description: row
|
|
|
@ -24,7 +66,15 @@
|
|
|
|
show_command: show ip interface brief
|
|
|
|
show_command: show ip interface brief
|
|
|
|
row_id: ROW_intf
|
|
|
|
row_id: ROW_intf
|
|
|
|
element_key1: intf-name
|
|
|
|
element_key1: intf-name
|
|
|
|
save_snapshot_locally: true
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
|
|
|
|
nxos_snapshot: *crss2
|
|
|
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
|
|
|
|
- name: compare snapshots
|
|
|
|
- name: compare snapshots
|
|
|
|
nxos_snapshot:
|
|
|
|
nxos_snapshot:
|
|
|
@ -35,25 +85,44 @@
|
|
|
|
compare_option: summary
|
|
|
|
compare_option: summary
|
|
|
|
path: '.'
|
|
|
|
path: '.'
|
|
|
|
|
|
|
|
|
|
|
|
- name: FAIL compare snapshots
|
|
|
|
- name: delete snapshot
|
|
|
|
nxos_snapshot:
|
|
|
|
nxos_snapshot: &del
|
|
|
|
action: compare
|
|
|
|
snapshot_name: test_snapshot2
|
|
|
|
snapshot1: test_snapshot1
|
|
|
|
action: delete
|
|
|
|
snapshot2: test_snapshot2
|
|
|
|
|
|
|
|
compare_option: summary
|
|
|
|
|
|
|
|
path: '.'
|
|
|
|
|
|
|
|
register: result
|
|
|
|
register: result
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
- assert: *true
|
|
|
|
that:
|
|
|
|
|
|
|
|
- 'result.failed == True'
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
- '"action is compare but all of the following are missing: comparison_results_file" in result.msg'
|
|
|
|
nxos_snapshot: *del
|
|
|
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: delete all snapshots
|
|
|
|
|
|
|
|
nxos_snapshot: &delall
|
|
|
|
|
|
|
|
action: delete_all
|
|
|
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
|
|
|
|
nxos_snapshot: *delall
|
|
|
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
|
|
|
|
when: snapshot_run
|
|
|
|
when: snapshot_run
|
|
|
|
|
|
|
|
|
|
|
|
always:
|
|
|
|
always:
|
|
|
|
- name: delete snapshot
|
|
|
|
- name: delete all sections
|
|
|
|
|
|
|
|
nxos_config:
|
|
|
|
|
|
|
|
commands:
|
|
|
|
|
|
|
|
- snapshot section delete myshow
|
|
|
|
|
|
|
|
match: none
|
|
|
|
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: delete all snapshots
|
|
|
|
nxos_snapshot:
|
|
|
|
nxos_snapshot:
|
|
|
|
action: delete_all
|
|
|
|
action: delete_all
|
|
|
|
ignore_errors: yes
|
|
|
|
ignore_errors: yes
|
|
|
|