On this page
net_ping - Tests reachability using ping from a network device
New in version 2.4.
Synopsis
- Tests reachability using ping from network device to a remote destination.
- For Windows targets, use the win_ping module instead.
- For targets running Python, use the ping module instead.
Parameters
Parameter | Choices/Defaults | 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 |
|
Determines if the expected result is success or fail.
|
vrf | Default:
"default"
|
The VRF to use for forwarding.
|
Notes
Note
Examples
- name: Test reachability to 10.10.10.10 using default vrf
net_ping:
dest: 10.10.10.10
- name: Test reachability to 10.20.20.20 using prod vrf
net_ping:
dest: 10.20.20.20
vrf: prod
- name: Test unreachability to 10.30.30.30 using default vrf
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
net_ping:
dest: 10.40.40.40
source: loopback0
vrf: prod
count: 20
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
commands
list
|
always |
Show the command sent.
Sample:
['ping vrf prod 10.40.40.40 count 20 source loopback0']
|
packet_loss
str
|
always |
Percentage of packets lost.
Sample:
0%
|
packets_rx
int
|
always |
Packets successfully received.
Sample:
20
|
packets_tx
int
|
always |
Packets successfully transmitted.
Sample:
20
|
rtt
dict
|
always |
Show RTT stats.
Sample:
{'avg': 2, 'max': 8, 'min': 1}
|
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Maintenance
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Author
- Jacob McGill (@jmcgill298)
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.6/modules/net_ping_module.html