| 1 |
.. _cisco.nxos.nxos_ping_module: |
| 2 |
|
| 3 |
|
| 4 |
******************** |
| 5 |
cisco.nxos.nxos_ping |
| 6 |
******************** |
| 7 |
|
| 8 |
**Tests reachability using ping from Nexus switch.** |
| 9 |
|
| 10 |
|
| 11 |
Version added: 1.0.0 |
| 12 |
|
| 13 |
.. contents:: |
| 14 |
:local: |
| 15 |
:depth: 1 |
| 16 |
|
| 17 |
|
| 18 |
Synopsis |
| 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 |
|
| 28 |
Parameters |
| 29 |
---------- |
| 30 |
|
| 31 |
.. raw:: html |
| 32 |
|
| 33 |
<table border=0 cellpadding=0 class="documentation-table"> |
| 34 |
<tr> |
| 35 |
<th colspan="1">Parameter</th> |
| 36 |
<th>Choices/<font color="blue">Defaults</font></th> |
| 37 |
<th width="100%">Comments</th> |
| 38 |
</tr> |
| 39 |
<tr> |
| 40 |
<td colspan="1"> |
| 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="1"> |
| 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="1"> |
| 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="1"> |
| 92 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 93 |
<b>size</b> |
| 94 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 95 |
<div style="font-size: small"> |
| 96 |
<span style="color: purple">integer</span> |
| 97 |
</div> |
| 98 |
</td> |
| 99 |
<td> |
| 100 |
</td> |
| 101 |
<td> |
| 102 |
<div>Size of packets to send.</div> |
| 103 |
</td> |
| 104 |
</tr> |
| 105 |
<tr> |
| 106 |
<td colspan="1"> |
| 107 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 108 |
<b>source</b> |
| 109 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 110 |
<div style="font-size: small"> |
| 111 |
<span style="color: purple">string</span> |
| 112 |
</div> |
| 113 |
</td> |
| 114 |
<td> |
| 115 |
</td> |
| 116 |
<td> |
| 117 |
<div>Source IP Address or hostname (resolvable by switch)</div> |
| 118 |
</td> |
| 119 |
</tr> |
| 120 |
<tr> |
| 121 |
<td colspan="1"> |
| 122 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 123 |
<b>state</b> |
| 124 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 125 |
<div style="font-size: small"> |
| 126 |
<span style="color: purple">string</span> |
| 127 |
</div> |
| 128 |
</td> |
| 129 |
<td> |
| 130 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 131 |
<li>absent</li> |
| 132 |
<li><div style="color: blue"><b>present</b> ←</div></li> |
| 133 |
</ul> |
| 134 |
</td> |
| 135 |
<td> |
| 136 |
<div>Determines if the expected result is success or fail.</div> |
| 137 |
</td> |
| 138 |
</tr> |
| 139 |
<tr> |
| 140 |
<td colspan="1"> |
| 141 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 142 |
<b>vrf</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 |
</td> |
| 150 |
<td> |
| 151 |
<div>Outgoing VRF.</div> |
| 152 |
</td> |
| 153 |
</tr> |
| 154 |
</table> |
| 155 |
<br/> |
| 156 |
|
| 157 |
|
| 158 |
Notes |
| 159 |
----- |
| 160 |
|
| 161 |
.. note:: |
| 162 |
- Unsupported for Cisco MDS |
| 163 |
- For a general purpose network module, see the :ref:`ansible.netcommon.net_ping <ansible.netcommon.net_ping_module>` module. |
| 164 |
- For Windows targets, use the :ref:`ansible.windows.win_ping <ansible.windows.win_ping_module>` module instead. |
| 165 |
- For targets running Python, use the :ref:`ansible.builtin.ping <ansible.builtin.ping_module>` module instead. |
| 166 |
- For information on using CLI and NX-API see the :ref:`NXOS Platform Options guide <nxos_platform_options>` |
| 167 |
- For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide <network_guide>` |
| 168 |
- For more information on using Ansible to manage Cisco devices see the `Cisco integration page <https://www.ansible.com/integrations/networks/cisco>`_. |
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
Examples |
| 173 |
-------- |
| 174 |
|
| 175 |
.. code-block:: yaml |
| 176 |
|
| 177 |
- name: Test reachability to 8.8.8.8 using mgmt vrf |
| 178 |
cisco.nxos.nxos_ping: |
| 179 |
dest: 8.8.8.8 |
| 180 |
vrf: management |
| 181 |
host: 68.170.147.165 |
| 182 |
|
| 183 |
- name: Test reachability to a few different public IPs using mgmt vrf |
| 184 |
cisco.nxos.nxos_ping: |
| 185 |
dest: "{{ item }}" |
| 186 |
vrf: management |
| 187 |
host: 68.170.147.165 |
| 188 |
with_items: |
| 189 |
- 8.8.8.8 |
| 190 |
- 4.4.4.4 |
| 191 |
- 198.6.1.4 |
| 192 |
|
| 193 |
- name: Test reachability to 8.8.8.8 using mgmt vrf, size and df-bit |
| 194 |
cisco.nxos.nxos_ping: |
| 195 |
dest: 8.8.8.8 |
| 196 |
df_bit: true |
| 197 |
size: 1400 |
| 198 |
vrf: management |
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
Return Values |
| 203 |
------------- |
| 204 |
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: |
| 205 |
|
| 206 |
.. raw:: html |
| 207 |
|
| 208 |
<table border=0 cellpadding=0 class="documentation-table"> |
| 209 |
<tr> |
| 210 |
<th colspan="1">Key</th> |
| 211 |
<th>Returned</th> |
| 212 |
<th width="100%">Description</th> |
| 213 |
</tr> |
| 214 |
<tr> |
| 215 |
<td colspan="1"> |
| 216 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 217 |
<b>commands</b> |
| 218 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 219 |
<div style="font-size: small"> |
| 220 |
<span style="color: purple">list</span> |
| 221 |
</div> |
| 222 |
</td> |
| 223 |
<td>always</td> |
| 224 |
<td> |
| 225 |
<div>Show the command sent</div> |
| 226 |
<br/> |
| 227 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 228 |
<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> |
| 229 |
</td> |
| 230 |
</tr> |
| 231 |
<tr> |
| 232 |
<td colspan="1"> |
| 233 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 234 |
<b>packet_loss</b> |
| 235 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 236 |
<div style="font-size: small"> |
| 237 |
<span style="color: purple">string</span> |
| 238 |
</div> |
| 239 |
</td> |
| 240 |
<td>always</td> |
| 241 |
<td> |
| 242 |
<div>Percentage of packets lost</div> |
| 243 |
<br/> |
| 244 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 245 |
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">0.00%</div> |
| 246 |
</td> |
| 247 |
</tr> |
| 248 |
<tr> |
| 249 |
<td colspan="1"> |
| 250 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 251 |
<b>packets_rx</b> |
| 252 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 253 |
<div style="font-size: small"> |
| 254 |
<span style="color: purple">integer</span> |
| 255 |
</div> |
| 256 |
</td> |
| 257 |
<td>always</td> |
| 258 |
<td> |
| 259 |
<div>Packets successfully received</div> |
| 260 |
<br/> |
| 261 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 262 |
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">2</div> |
| 263 |
</td> |
| 264 |
</tr> |
| 265 |
<tr> |
| 266 |
<td colspan="1"> |
| 267 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 268 |
<b>packets_tx</b> |
| 269 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 270 |
<div style="font-size: small"> |
| 271 |
<span style="color: purple">integer</span> |
| 272 |
</div> |
| 273 |
</td> |
| 274 |
<td>always</td> |
| 275 |
<td> |
| 276 |
<div>Packets successfully transmitted</div> |
| 277 |
<br/> |
| 278 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 279 |
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">2</div> |
| 280 |
</td> |
| 281 |
</tr> |
| 282 |
<tr> |
| 283 |
<td colspan="1"> |
| 284 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 285 |
<b>rtt</b> |
| 286 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 287 |
<div style="font-size: small"> |
| 288 |
<span style="color: purple">dictionary</span> |
| 289 |
</div> |
| 290 |
</td> |
| 291 |
<td>always</td> |
| 292 |
<td> |
| 293 |
<div>Show RTT stats</div> |
| 294 |
<br/> |
| 295 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 296 |
<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> |
| 297 |
</td> |
| 298 |
</tr> |
| 299 |
</table> |
| 300 |
<br/><br/> |
| 301 |
|
| 302 |
|
| 303 |
Status |
| 304 |
------ |
| 305 |
|
| 306 |
|
| 307 |
Authors |
| 308 |
~~~~~~~ |
| 309 |
|
| 310 |
- Jason Edelman (@jedelman8) |
| 311 |
- Gabriele Gerbino (@GGabriele) |