1.. _cisco.nxos.nxos_ping_module: 2 3 4******************** 5cisco.nxos.nxos_ping 6******************** 7 8**Tests reachability using ping from Nexus switch.** 9 10 11Version added: 1.0.0 12 13.. contents:: 14 :local: 15 :depth: 1 16 17 18Synopsis 19-------- 20- Tests reachability using ping from switch to a remote destination. 21- For a general purpose network module, see the :ref:`ansible.netcommon.net_ping <ansible.netcommon.net_ping_module>` module. 22- For Windows targets, use the :ref:`ansible.windows.win_ping <ansible.windows.win_ping_module>` module instead. 23- For targets running Python, use the :ref:`ansible.builtin.ping <ansible.builtin.ping_module>` module instead. 24 25 26 27 28Parameters 29---------- 30 31.. raw:: html 32 33 <table border=0 cellpadding=0 class="documentation-table"> 34 <tr> 35 <th colspan="2">Parameter</th> 36 <th>Choices/<font color="blue">Defaults</font></th> 37 <th width="100%">Comments</th> 38 </tr> 39 <tr> 40 <td colspan="2"> 41 <div class="ansibleOptionAnchor" id="parameter-"></div> 42 <b>count</b> 43 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 44 <div style="font-size: small"> 45 <span style="color: purple">integer</span> 46 </div> 47 </td> 48 <td> 49 <b>Default:</b><br/><div style="color: blue">5</div> 50 </td> 51 <td> 52 <div>Number of packets to send.</div> 53 </td> 54 </tr> 55 <tr> 56 <td colspan="2"> 57 <div class="ansibleOptionAnchor" id="parameter-"></div> 58 <b>dest</b> 59 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 60 <div style="font-size: small"> 61 <span style="color: purple">string</span> 62 / <span style="color: red">required</span> 63 </div> 64 </td> 65 <td> 66 </td> 67 <td> 68 <div>IP address or hostname (resolvable by switch) of remote node.</div> 69 </td> 70 </tr> 71 <tr> 72 <td colspan="2"> 73 <div class="ansibleOptionAnchor" id="parameter-"></div> 74 <b>df_bit</b> 75 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 76 <div style="font-size: small"> 77 <span style="color: purple">boolean</span> 78 </div> 79 </td> 80 <td> 81 <ul style="margin: 0; padding: 0"><b>Choices:</b> 82 <li><div style="color: blue"><b>no</b> ←</div></li> 83 <li>yes</li> 84 </ul> 85 </td> 86 <td> 87 <div>Set the DF bit.</div> 88 </td> 89 </tr> 90 <tr> 91 <td colspan="2"> 92 <div class="ansibleOptionAnchor" id="parameter-"></div> 93 <b>provider</b> 94 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 95 <div style="font-size: small"> 96 <span style="color: purple">dictionary</span> 97 </div> 98 </td> 99 <td> 100 </td> 101 <td> 102 <div><b>Deprecated</b></div> 103 <div>Starting with Ansible 2.5 we recommend using <code>connection: network_cli</code>.</div> 104 <div>Starting with Ansible 2.6 we recommend using <code>connection: httpapi</code> for NX-API.</div> 105 <div>This option will be removed in a release after 2022-06-01.</div> 106 <div>For more information please see the <a href='https://docs.ansible.com/ansible/latest/network/user_guide/platform_nxos.html'>https://docs.ansible.com/ansible/latest/network/user_guide/platform_nxos.html</a>.</div> 107 <div><hr/></div> 108 <div>A dict object containing connection details.</div> 109 </td> 110 </tr> 111 <tr> 112 <td class="elbow-placeholder"></td> 113 <td colspan="1"> 114 <div class="ansibleOptionAnchor" id="parameter-"></div> 115 <b>auth_pass</b> 116 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 117 <div style="font-size: small"> 118 <span style="color: purple">string</span> 119 </div> 120 </td> 121 <td> 122 </td> 123 <td> 124 <div>Specifies the password to use if required to enter privileged mode on the remote device. If <em>authorize</em> is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTH_PASS</code> will be used instead.</div> 125 </td> 126 </tr> 127 <tr> 128 <td class="elbow-placeholder"></td> 129 <td colspan="1"> 130 <div class="ansibleOptionAnchor" id="parameter-"></div> 131 <b>authorize</b> 132 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 133 <div style="font-size: small"> 134 <span style="color: purple">boolean</span> 135 </div> 136 </td> 137 <td> 138 <ul style="margin: 0; padding: 0"><b>Choices:</b> 139 <li><div style="color: blue"><b>no</b> ←</div></li> 140 <li>yes</li> 141 </ul> 142 </td> 143 <td> 144 <div>Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTHORIZE</code> will be used instead.</div> 145 </td> 146 </tr> 147 <tr> 148 <td class="elbow-placeholder"></td> 149 <td colspan="1"> 150 <div class="ansibleOptionAnchor" id="parameter-"></div> 151 <b>host</b> 152 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 153 <div style="font-size: small"> 154 <span style="color: purple">string</span> 155 </div> 156 </td> 157 <td> 158 </td> 159 <td> 160 <div>Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.</div> 161 </td> 162 </tr> 163 <tr> 164 <td class="elbow-placeholder"></td> 165 <td colspan="1"> 166 <div class="ansibleOptionAnchor" id="parameter-"></div> 167 <b>password</b> 168 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 169 <div style="font-size: small"> 170 <span style="color: purple">string</span> 171 </div> 172 </td> 173 <td> 174 </td> 175 <td> 176 <div>Specifies the password to use to authenticate the connection to the remote device. This is a common argument used for either <em>cli</em> or <em>nxapi</em> transports. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_PASSWORD</code> will be used instead.</div> 177 </td> 178 </tr> 179 <tr> 180 <td class="elbow-placeholder"></td> 181 <td colspan="1"> 182 <div class="ansibleOptionAnchor" id="parameter-"></div> 183 <b>port</b> 184 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 185 <div style="font-size: small"> 186 <span style="color: purple">integer</span> 187 </div> 188 </td> 189 <td> 190 </td> 191 <td> 192 <div>Specifies the port to use when building the connection to the remote device. This value applies to either <em>cli</em> or <em>nxapi</em>. The port value will default to the appropriate transport common port if none is provided in the task. (cli=22, http=80, https=443).</div> 193 </td> 194 </tr> 195 <tr> 196 <td class="elbow-placeholder"></td> 197 <td colspan="1"> 198 <div class="ansibleOptionAnchor" id="parameter-"></div> 199 <b>ssh_keyfile</b> 200 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 201 <div style="font-size: small"> 202 <span style="color: purple">string</span> 203 </div> 204 </td> 205 <td> 206 </td> 207 <td> 208 <div>Specifies the SSH key to use to authenticate the connection to the remote device. This argument is only used for the <em>cli</em> transport. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_SSH_KEYFILE</code> will be used instead.</div> 209 </td> 210 </tr> 211 <tr> 212 <td class="elbow-placeholder"></td> 213 <td colspan="1"> 214 <div class="ansibleOptionAnchor" id="parameter-"></div> 215 <b>timeout</b> 216 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 217 <div style="font-size: small"> 218 <span style="color: purple">integer</span> 219 </div> 220 </td> 221 <td> 222 </td> 223 <td> 224 <div>Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. NX-API can be slow to return on long-running commands (sh mac, sh bgp, etc).</div> 225 </td> 226 </tr> 227 <tr> 228 <td class="elbow-placeholder"></td> 229 <td colspan="1"> 230 <div class="ansibleOptionAnchor" id="parameter-"></div> 231 <b>transport</b> 232 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 233 <div style="font-size: small"> 234 <span style="color: purple">string</span> 235 </div> 236 </td> 237 <td> 238 <ul style="margin: 0; padding: 0"><b>Choices:</b> 239 <li><div style="color: blue"><b>cli</b> ←</div></li> 240 <li>nxapi</li> 241 </ul> 242 </td> 243 <td> 244 <div>Configures the transport connection to use when connecting to the remote device. The transport argument supports connectivity to the device over cli (ssh) or nxapi.</div> 245 </td> 246 </tr> 247 <tr> 248 <td class="elbow-placeholder"></td> 249 <td colspan="1"> 250 <div class="ansibleOptionAnchor" id="parameter-"></div> 251 <b>use_proxy</b> 252 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 253 <div style="font-size: small"> 254 <span style="color: purple">boolean</span> 255 </div> 256 </td> 257 <td> 258 <ul style="margin: 0; padding: 0"><b>Choices:</b> 259 <li>no</li> 260 <li><div style="color: blue"><b>yes</b> ←</div></li> 261 </ul> 262 </td> 263 <td> 264 <div>If <code>no</code>, the environment variables <code>http_proxy</code> and <code>https_proxy</code> will be ignored.</div> 265 </td> 266 </tr> 267 <tr> 268 <td class="elbow-placeholder"></td> 269 <td colspan="1"> 270 <div class="ansibleOptionAnchor" id="parameter-"></div> 271 <b>use_ssl</b> 272 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 273 <div style="font-size: small"> 274 <span style="color: purple">boolean</span> 275 </div> 276 </td> 277 <td> 278 <ul style="margin: 0; padding: 0"><b>Choices:</b> 279 <li><div style="color: blue"><b>no</b> ←</div></li> 280 <li>yes</li> 281 </ul> 282 </td> 283 <td> 284 <div>Configures the <em>transport</em> to use SSL if set to <code>yes</code> only when the <code>transport=nxapi</code>, otherwise this value is ignored.</div> 285 </td> 286 </tr> 287 <tr> 288 <td class="elbow-placeholder"></td> 289 <td colspan="1"> 290 <div class="ansibleOptionAnchor" id="parameter-"></div> 291 <b>username</b> 292 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 293 <div style="font-size: small"> 294 <span style="color: purple">string</span> 295 </div> 296 </td> 297 <td> 298 </td> 299 <td> 300 <div>Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate either the CLI login or the nxapi authentication depending on which transport is used. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_USERNAME</code> will be used instead.</div> 301 </td> 302 </tr> 303 <tr> 304 <td class="elbow-placeholder"></td> 305 <td colspan="1"> 306 <div class="ansibleOptionAnchor" id="parameter-"></div> 307 <b>validate_certs</b> 308 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 309 <div style="font-size: small"> 310 <span style="color: purple">boolean</span> 311 </div> 312 </td> 313 <td> 314 <ul style="margin: 0; padding: 0"><b>Choices:</b> 315 <li><div style="color: blue"><b>no</b> ←</div></li> 316 <li>yes</li> 317 </ul> 318 </td> 319 <td> 320 <div>If <code>no</code>, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If the transport argument is not nxapi, this value is ignored.</div> 321 </td> 322 </tr> 323 324 <tr> 325 <td colspan="2"> 326 <div class="ansibleOptionAnchor" id="parameter-"></div> 327 <b>size</b> 328 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 329 <div style="font-size: small"> 330 <span style="color: purple">integer</span> 331 </div> 332 </td> 333 <td> 334 </td> 335 <td> 336 <div>Size of packets to send.</div> 337 </td> 338 </tr> 339 <tr> 340 <td colspan="2"> 341 <div class="ansibleOptionAnchor" id="parameter-"></div> 342 <b>source</b> 343 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 344 <div style="font-size: small"> 345 <span style="color: purple">string</span> 346 </div> 347 </td> 348 <td> 349 </td> 350 <td> 351 <div>Source IP Address or hostname (resolvable by switch)</div> 352 </td> 353 </tr> 354 <tr> 355 <td colspan="2"> 356 <div class="ansibleOptionAnchor" id="parameter-"></div> 357 <b>state</b> 358 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 359 <div style="font-size: small"> 360 <span style="color: purple">string</span> 361 </div> 362 </td> 363 <td> 364 <ul style="margin: 0; padding: 0"><b>Choices:</b> 365 <li>absent</li> 366 <li><div style="color: blue"><b>present</b> ←</div></li> 367 </ul> 368 </td> 369 <td> 370 <div>Determines if the expected result is success or fail.</div> 371 </td> 372 </tr> 373 <tr> 374 <td colspan="2"> 375 <div class="ansibleOptionAnchor" id="parameter-"></div> 376 <b>vrf</b> 377 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> 378 <div style="font-size: small"> 379 <span style="color: purple">string</span> 380 </div> 381 </td> 382 <td> 383 </td> 384 <td> 385 <div>Outgoing VRF.</div> 386 </td> 387 </tr> 388 </table> 389 <br/> 390 391 392Notes 393----- 394 395.. note:: 396 - Unsupported for Cisco MDS 397 - For a general purpose network module, see the :ref:`ansible.netcommon.net_ping <ansible.netcommon.net_ping_module>` module. 398 - For Windows targets, use the :ref:`ansible.windows.win_ping <ansible.windows.win_ping_module>` module instead. 399 - For targets running Python, use the :ref:`ansible.builtin.ping <ansible.builtin.ping_module>` module instead. 400 - For information on using CLI and NX-API see the :ref:`NXOS Platform Options guide <nxos_platform_options>` 401 - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide <network_guide>` 402 - For more information on using Ansible to manage Cisco devices see the `Cisco integration page <https://www.ansible.com/integrations/networks/cisco>`_. 403 404 405 406Examples 407-------- 408 409.. code-block:: yaml 410 411 - name: Test reachability to 8.8.8.8 using mgmt vrf 412 cisco.nxos.nxos_ping: 413 dest: 8.8.8.8 414 vrf: management 415 host: 68.170.147.165 416 417 - name: Test reachability to a few different public IPs using mgmt vrf 418 cisco.nxos.nxos_ping: 419 dest: "{{ item }}" 420 vrf: management 421 host: 68.170.147.165 422 with_items: 423 - 8.8.8.8 424 - 4.4.4.4 425 - 198.6.1.4 426 427 - name: Test reachability to 8.8.8.8 using mgmt vrf, size and df-bit 428 cisco.nxos.nxos_ping: 429 dest: 8.8.8.8 430 df_bit: true 431 size: 1400 432 vrf: management 433 434 435 436Return Values 437------------- 438Common 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: 439 440.. raw:: html 441 442 <table border=0 cellpadding=0 class="documentation-table"> 443 <tr> 444 <th colspan="1">Key</th> 445 <th>Returned</th> 446 <th width="100%">Description</th> 447 </tr> 448 <tr> 449 <td colspan="1"> 450 <div class="ansibleOptionAnchor" id="return-"></div> 451 <b>commands</b> 452 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> 453 <div style="font-size: small"> 454 <span style="color: purple">list</span> 455 </div> 456 </td> 457 <td>always</td> 458 <td> 459 <div>Show the command sent</div> 460 <br/> 461 <div style="font-size: smaller"><b>Sample:</b></div> 462 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['ping 8.8.8.8 count 2 vrf management']</div> 463 </td> 464 </tr> 465 <tr> 466 <td colspan="1"> 467 <div class="ansibleOptionAnchor" id="return-"></div> 468 <b>packet_loss</b> 469 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> 470 <div style="font-size: small"> 471 <span style="color: purple">string</span> 472 </div> 473 </td> 474 <td>always</td> 475 <td> 476 <div>Percentage of packets lost</div> 477 <br/> 478 <div style="font-size: smaller"><b>Sample:</b></div> 479 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">0.00%</div> 480 </td> 481 </tr> 482 <tr> 483 <td colspan="1"> 484 <div class="ansibleOptionAnchor" id="return-"></div> 485 <b>packets_rx</b> 486 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> 487 <div style="font-size: small"> 488 <span style="color: purple">integer</span> 489 </div> 490 </td> 491 <td>always</td> 492 <td> 493 <div>Packets successfully received</div> 494 <br/> 495 <div style="font-size: smaller"><b>Sample:</b></div> 496 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">2</div> 497 </td> 498 </tr> 499 <tr> 500 <td colspan="1"> 501 <div class="ansibleOptionAnchor" id="return-"></div> 502 <b>packets_tx</b> 503 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> 504 <div style="font-size: small"> 505 <span style="color: purple">integer</span> 506 </div> 507 </td> 508 <td>always</td> 509 <td> 510 <div>Packets successfully transmitted</div> 511 <br/> 512 <div style="font-size: smaller"><b>Sample:</b></div> 513 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">2</div> 514 </td> 515 </tr> 516 <tr> 517 <td colspan="1"> 518 <div class="ansibleOptionAnchor" id="return-"></div> 519 <b>rtt</b> 520 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> 521 <div style="font-size: small"> 522 <span style="color: purple">dictionary</span> 523 </div> 524 </td> 525 <td>always</td> 526 <td> 527 <div>Show RTT stats</div> 528 <br/> 529 <div style="font-size: smaller"><b>Sample:</b></div> 530 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">{'avg': 6.264, 'max': 6.564, 'min': 5.978}</div> 531 </td> 532 </tr> 533 </table> 534 <br/><br/> 535 536 537Status 538------ 539 540 541Authors 542~~~~~~~ 543 544- Jason Edelman (@jedelman8) 545- Gabriele Gerbino (@GGabriele) 546