net_ping¶
Collection Note
This module is part of the ansible.netcommon collection. To install the collection, use:
Added in version1.0.0.
Synopsis¶
- Tests reachability using ping from network device to a remote destination.
Parameters¶
| Parameter | Defaults / Choices | Comments |
|---|---|---|
| count | Default: 5 |
Number of packets to send. |
| dest required |
The IP Address or hostname (resolvable by switch) of the remote node. | |
| source | The source IP Address. | |
| state | Default: present Choices: absent, present |
Determines if the expected result is success or fail. |
| vrf | Default: default |
The VRF to use for forwarding. |
Notes¶
Note
- For targets running Python, use the M(ansible.builtin.shell) module along with ping command instead.
- This module is supported on C(ansible_network_os) network platforms. See the :ref:
Network Platform Options <platform_options>for details.
Examples¶
- name: Test reachability to 10.10.10.10 using default vrf
ansible.netcommon.net_ping:
dest: 10.10.10.10
- name: Test reachability to 10.20.20.20 using prod vrf
ansible.netcommon.net_ping:
dest: 10.20.20.20
vrf: prod
- name: Test unreachability to 10.30.30.30 using default vrf
ansible.netcommon.net_ping:
dest: 10.30.30.30
state: absent
- name: Test reachability to 10.40.40.40 using prod vrf and setting count and source
ansible.netcommon.net_ping:
dest: 10.40.40.40
source: loopback0
vrf: prod
count: 20
- Note:
- For targets running Python, use the M(ansible.builtin.shell) module along with ping command instead.
- Example:
name: ping
shell: ping -c 1 <remote-ip>
Return Values¶
| Key | Data Type | Description | Returned |
|---|---|---|---|
| commands | list | Show the command sent. | always |
| packet_loss | str | Percentage of packets lost. | always |
| packets_rx | int | Packets successfully received. | always |
| packets_tx | int | Packets successfully transmitted. | always |
| rtt | dict | Show RTT stats. | always |
Authors¶
- Jacob Mcgill (@jmcgill298)