ansible.builtin.nxos_snapshot (v2.7.16) — module

Manage snapshots of the running states of selected features.

| "added in version" 2.2 of ansible.builtin"

Authors: Gabriele Gerbino (@GGabriele)

preview | supported by network

Install Ansible via pip

Install with pip install ansible==2.7.16

Description

Create snapshots of the running states of selected features, add new show commands for snapshot creation, delete and compare existing snapshots.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a snapshot and store it locally
- nxos_snapshot:
    action: create
    snapshot_name: test_snapshot
    description: Done with Ansible
    save_snapshot_locally: true
    path: /home/user/snapshots/
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Delete a snapshot
- nxos_snapshot:
    action: delete
    snapshot_name: test_snapshot
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Delete all existing snapshots
- nxos_snapshot:
    action: delete_all
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Add a show command for snapshots creation
- nxos_snapshot:
    section: myshow
    show_command: show ip interface brief
    row_id: ROW_intf
    element_key1: intf-name
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Compare two snapshots
- nxos_snapshot:
    action: compare
    snapshot1: pre_snapshot
    snapshot2: post_snapshot
    comparison_results_file: compare_snapshots.txt
    compare_option: summary
    path: '../snapshot_reports/'

Inputs

    
path:
    default: ./
    description:
    - Specify the path of the file where new created snapshot or snapshots comparison
      will be stored, to be used when C(action=create) and C(save_snapshot_locally=true)
      or C(action=compare).

action:
    choices:
    - add
    - compare
    - create
    - delete
    - delete_all
    description:
    - Define what snapshot action the module would perform.
    required: true

row_id:
    description:
    - Specifies the tag of each row entry of the show command's XML output, to be used
      when C(action=add).

section:
    description:
    - Used to name the show command output, to be used when C(action=add).

snapshot1:
    description:
    - First snapshot to be used when C(action=compare).

snapshot2:
    description:
    - Second snapshot to be used when C(action=compare).

description:
    description:
    - Snapshot description to be used when C(action=create).

element_key1:
    description:
    - Specify the tags used to distinguish among row entries, to be used when C(action=add).

element_key2:
    description:
    - Specify the tags used to distinguish among row entries, to be used when C(action=add).

show_command:
    description:
    - Specify a new show command, to be used when C(action=add).

snapshot_name:
    description:
    - Snapshot name, to be used when C(action=create) or C(action=delete).

compare_option:
    choices:
    - summary
    - ipv4routes
    - ipv6routes
    description:
    - Snapshot options to be used when C(action=compare).

save_snapshot_locally:
    default: 'no'
    description:
    - Specify to locally store a new created snapshot, to be used when C(action=create).
    type: bool

comparison_results_file:
    description:
    - Name of the file where snapshots comparison will be stored when C(action=compare).

Outputs

commands:
  description: commands sent to the device
  returned: verbose mode
  sample:
  - snapshot create post_snapshot Post-snapshot
  type: list