| 1 |
.. _cisco.nxos.nxos_snapshot_module: |
| 2 |
|
| 3 |
|
| 4 |
************************ |
| 5 |
cisco.nxos.nxos_snapshot |
| 6 |
************************ |
| 7 |
|
| 8 |
**Manage snapshots of the running states of selected features.** |
| 9 |
|
| 10 |
|
| 11 |
Version added: 1.0.0 |
| 12 |
|
| 13 |
.. contents:: |
| 14 |
:local: |
| 15 |
:depth: 1 |
| 16 |
|
| 17 |
|
| 18 |
Synopsis |
| 19 |
-------- |
| 20 |
- Create snapshots of the running states of selected features, add new show commands for snapshot creation, delete and compare existing snapshots. |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
Parameters |
| 26 |
---------- |
| 27 |
|
| 28 |
.. raw:: html |
| 29 |
|
| 30 |
<table border=0 cellpadding=0 class="documentation-table"> |
| 31 |
<tr> |
| 32 |
<th colspan="1">Parameter</th> |
| 33 |
<th>Choices/<font color="blue">Defaults</font></th> |
| 34 |
<th width="100%">Comments</th> |
| 35 |
</tr> |
| 36 |
<tr> |
| 37 |
<td colspan="1"> |
| 38 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 39 |
<b>action</b> |
| 40 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 41 |
<div style="font-size: small"> |
| 42 |
<span style="color: purple">string</span> |
| 43 |
/ <span style="color: red">required</span> |
| 44 |
</div> |
| 45 |
</td> |
| 46 |
<td> |
| 47 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 48 |
<li>add</li> |
| 49 |
<li>compare</li> |
| 50 |
<li>create</li> |
| 51 |
<li>delete</li> |
| 52 |
<li>delete_all</li> |
| 53 |
</ul> |
| 54 |
</td> |
| 55 |
<td> |
| 56 |
<div>Define what snapshot action the module would perform.</div> |
| 57 |
</td> |
| 58 |
</tr> |
| 59 |
<tr> |
| 60 |
<td colspan="1"> |
| 61 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 62 |
<b>compare_option</b> |
| 63 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 64 |
<div style="font-size: small"> |
| 65 |
<span style="color: purple">string</span> |
| 66 |
</div> |
| 67 |
</td> |
| 68 |
<td> |
| 69 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 70 |
<li>summary</li> |
| 71 |
<li>ipv4routes</li> |
| 72 |
<li>ipv6routes</li> |
| 73 |
</ul> |
| 74 |
</td> |
| 75 |
<td> |
| 76 |
<div>Snapshot options to be used when <code>action=compare</code>.</div> |
| 77 |
</td> |
| 78 |
</tr> |
| 79 |
<tr> |
| 80 |
<td colspan="1"> |
| 81 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 82 |
<b>comparison_results_file</b> |
| 83 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 84 |
<div style="font-size: small"> |
| 85 |
<span style="color: purple">string</span> |
| 86 |
</div> |
| 87 |
</td> |
| 88 |
<td> |
| 89 |
</td> |
| 90 |
<td> |
| 91 |
<div>Name of the file where snapshots comparison will be stored when <code>action=compare</code>.</div> |
| 92 |
</td> |
| 93 |
</tr> |
| 94 |
<tr> |
| 95 |
<td colspan="1"> |
| 96 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 97 |
<b>description</b> |
| 98 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 99 |
<div style="font-size: small"> |
| 100 |
<span style="color: purple">string</span> |
| 101 |
</div> |
| 102 |
</td> |
| 103 |
<td> |
| 104 |
</td> |
| 105 |
<td> |
| 106 |
<div>Snapshot description to be used when <code>action=create</code>.</div> |
| 107 |
</td> |
| 108 |
</tr> |
| 109 |
<tr> |
| 110 |
<td colspan="1"> |
| 111 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 112 |
<b>element_key1</b> |
| 113 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 114 |
<div style="font-size: small"> |
| 115 |
<span style="color: purple">string</span> |
| 116 |
</div> |
| 117 |
</td> |
| 118 |
<td> |
| 119 |
</td> |
| 120 |
<td> |
| 121 |
<div>Specify the tags used to distinguish among row entries, to be used when <code>action=add</code>.</div> |
| 122 |
</td> |
| 123 |
</tr> |
| 124 |
<tr> |
| 125 |
<td colspan="1"> |
| 126 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 127 |
<b>element_key2</b> |
| 128 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 129 |
<div style="font-size: small"> |
| 130 |
<span style="color: purple">string</span> |
| 131 |
</div> |
| 132 |
</td> |
| 133 |
<td> |
| 134 |
</td> |
| 135 |
<td> |
| 136 |
<div>Specify the tags used to distinguish among row entries, to be used when <code>action=add</code>.</div> |
| 137 |
</td> |
| 138 |
</tr> |
| 139 |
<tr> |
| 140 |
<td colspan="1"> |
| 141 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 142 |
<b>path</b> |
| 143 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 144 |
<div style="font-size: small"> |
| 145 |
<span style="color: purple">string</span> |
| 146 |
</div> |
| 147 |
</td> |
| 148 |
<td> |
| 149 |
<b>Default:</b><br/><div style="color: blue">"./"</div> |
| 150 |
</td> |
| 151 |
<td> |
| 152 |
<div>Specify the path of the file where new created snapshot or snapshots comparison will be stored, to be used when <code>action=create</code> and <code>save_snapshot_locally=true</code> or <code>action=compare</code>.</div> |
| 153 |
</td> |
| 154 |
</tr> |
| 155 |
<tr> |
| 156 |
<td colspan="1"> |
| 157 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 158 |
<b>row_id</b> |
| 159 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 160 |
<div style="font-size: small"> |
| 161 |
<span style="color: purple">string</span> |
| 162 |
</div> |
| 163 |
</td> |
| 164 |
<td> |
| 165 |
</td> |
| 166 |
<td> |
| 167 |
<div>Specifies the tag of each row entry of the show command's XML output, to be used when <code>action=add</code>.</div> |
| 168 |
</td> |
| 169 |
</tr> |
| 170 |
<tr> |
| 171 |
<td colspan="1"> |
| 172 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 173 |
<b>save_snapshot_locally</b> |
| 174 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 175 |
<div style="font-size: small"> |
| 176 |
<span style="color: purple">boolean</span> |
| 177 |
</div> |
| 178 |
</td> |
| 179 |
<td> |
| 180 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 181 |
<li><div style="color: blue"><b>no</b> ←</div></li> |
| 182 |
<li>yes</li> |
| 183 |
</ul> |
| 184 |
</td> |
| 185 |
<td> |
| 186 |
<div>Specify to locally store a new created snapshot, to be used when <code>action=create</code>.</div> |
| 187 |
</td> |
| 188 |
</tr> |
| 189 |
<tr> |
| 190 |
<td colspan="1"> |
| 191 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 192 |
<b>section</b> |
| 193 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 194 |
<div style="font-size: small"> |
| 195 |
<span style="color: purple">string</span> |
| 196 |
</div> |
| 197 |
</td> |
| 198 |
<td> |
| 199 |
</td> |
| 200 |
<td> |
| 201 |
<div>Used to name the show command output, to be used when <code>action=add</code>.</div> |
| 202 |
</td> |
| 203 |
</tr> |
| 204 |
<tr> |
| 205 |
<td colspan="1"> |
| 206 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 207 |
<b>show_command</b> |
| 208 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 209 |
<div style="font-size: small"> |
| 210 |
<span style="color: purple">string</span> |
| 211 |
</div> |
| 212 |
</td> |
| 213 |
<td> |
| 214 |
</td> |
| 215 |
<td> |
| 216 |
<div>Specify a new show command, to be used when <code>action=add</code>.</div> |
| 217 |
</td> |
| 218 |
</tr> |
| 219 |
<tr> |
| 220 |
<td colspan="1"> |
| 221 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 222 |
<b>snapshot1</b> |
| 223 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 224 |
<div style="font-size: small"> |
| 225 |
<span style="color: purple">string</span> |
| 226 |
</div> |
| 227 |
</td> |
| 228 |
<td> |
| 229 |
</td> |
| 230 |
<td> |
| 231 |
<div>First snapshot to be used when <code>action=compare</code>.</div> |
| 232 |
</td> |
| 233 |
</tr> |
| 234 |
<tr> |
| 235 |
<td colspan="1"> |
| 236 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 237 |
<b>snapshot2</b> |
| 238 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 239 |
<div style="font-size: small"> |
| 240 |
<span style="color: purple">string</span> |
| 241 |
</div> |
| 242 |
</td> |
| 243 |
<td> |
| 244 |
</td> |
| 245 |
<td> |
| 246 |
<div>Second snapshot to be used when <code>action=compare</code>.</div> |
| 247 |
</td> |
| 248 |
</tr> |
| 249 |
<tr> |
| 250 |
<td colspan="1"> |
| 251 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 252 |
<b>snapshot_name</b> |
| 253 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 254 |
<div style="font-size: small"> |
| 255 |
<span style="color: purple">string</span> |
| 256 |
</div> |
| 257 |
</td> |
| 258 |
<td> |
| 259 |
</td> |
| 260 |
<td> |
| 261 |
<div>Snapshot name, to be used when <code>action=create</code> or <code>action=delete</code>.</div> |
| 262 |
</td> |
| 263 |
</tr> |
| 264 |
</table> |
| 265 |
<br/> |
| 266 |
|
| 267 |
|
| 268 |
Notes |
| 269 |
----- |
| 270 |
|
| 271 |
.. note:: |
| 272 |
- Tested against NXOSv 7.3.(0)D1(1) on VIRL |
| 273 |
- Unsupported for Cisco MDS |
| 274 |
- ``transport=cli`` may cause timeout errors. |
| 275 |
- The ``element_key1`` and ``element_key2`` parameter specify the tags used to distinguish among row entries. In most cases, only the element_key1 parameter needs to specified to be able to distinguish among row entries. |
| 276 |
- ``action=compare`` will always store a comparison report on a local file. |
| 277 |
- For information on using CLI and NX-API see the :ref:`NXOS Platform Options guide <nxos_platform_options>` |
| 278 |
- For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide <network_guide>` |
| 279 |
- For more information on using Ansible to manage Cisco devices see the `Cisco integration page <https://www.ansible.com/integrations/networks/cisco>`_. |
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
Examples |
| 284 |
-------- |
| 285 |
|
| 286 |
.. code-block:: yaml |
| 287 |
|
| 288 |
# Create a snapshot and store it locally |
| 289 |
- cisco.nxos.nxos_snapshot: |
| 290 |
action: create |
| 291 |
snapshot_name: test_snapshot |
| 292 |
description: Done with Ansible |
| 293 |
save_snapshot_locally: true |
| 294 |
path: /home/user/snapshots/ |
| 295 |
|
| 296 |
# Delete a snapshot |
| 297 |
- cisco.nxos.nxos_snapshot: |
| 298 |
action: delete |
| 299 |
snapshot_name: test_snapshot |
| 300 |
|
| 301 |
# Delete all existing snapshots |
| 302 |
- cisco.nxos.nxos_snapshot: |
| 303 |
action: delete_all |
| 304 |
|
| 305 |
# Add a show command for snapshots creation |
| 306 |
- cisco.nxos.nxos_snapshot: |
| 307 |
section: myshow |
| 308 |
show_command: show ip interface brief |
| 309 |
row_id: ROW_intf |
| 310 |
element_key1: intf-name |
| 311 |
|
| 312 |
# Compare two snapshots |
| 313 |
- cisco.nxos.nxos_snapshot: |
| 314 |
action: compare |
| 315 |
snapshot1: pre_snapshot |
| 316 |
snapshot2: post_snapshot |
| 317 |
comparison_results_file: compare_snapshots.txt |
| 318 |
compare_option: summary |
| 319 |
path: ../snapshot_reports/ |
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
Return Values |
| 324 |
------------- |
| 325 |
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module: |
| 326 |
|
| 327 |
.. raw:: html |
| 328 |
|
| 329 |
<table border=0 cellpadding=0 class="documentation-table"> |
| 330 |
<tr> |
| 331 |
<th colspan="1">Key</th> |
| 332 |
<th>Returned</th> |
| 333 |
<th width="100%">Description</th> |
| 334 |
</tr> |
| 335 |
<tr> |
| 336 |
<td colspan="1"> |
| 337 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 338 |
<b>commands</b> |
| 339 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 340 |
<div style="font-size: small"> |
| 341 |
<span style="color: purple">list</span> |
| 342 |
</div> |
| 343 |
</td> |
| 344 |
<td>verbose mode</td> |
| 345 |
<td> |
| 346 |
<div>commands sent to the device</div> |
| 347 |
<br/> |
| 348 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 349 |
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['snapshot create post_snapshot Post-snapshot']</div> |
| 350 |
</td> |
| 351 |
</tr> |
| 352 |
</table> |
| 353 |
<br/><br/> |
| 354 |
|
| 355 |
|
| 356 |
Status |
| 357 |
------ |
| 358 |
|
| 359 |
|
| 360 |
Authors |
| 361 |
~~~~~~~ |
| 362 |
|
| 363 |
- Gabriele Gerbino (@GGabriele) |