W3cubDocs

/Ansible 2.10

ansible.netcommon.net_ping – Tests reachability using ping from a network device

Note

This plugin is part of the ansible.netcommon collection.

To install it use: ansible-galaxy collection install ansible.netcommon.

To use it in a playbook, specify: ansible.netcommon.net_ping.

New in version 1.0.0: of ansible.netcommon

Synopsis

Note

This module has a corresponding action plugin.

Parameters

Parameter Choices/Defaults Comments
count
string
Default:
5
Number of packets to send.
dest
string / required
The IP Address or hostname (resolvable by switch) of the remote node.
source
string
The source IP Address.
state
string
    Choices:
  • absent
  • present
Determines if the expected result is success or fail.
vrf
string
Default:
"default"
The VRF to use for forwarding.

Notes

Note

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

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
commands
list / elements=string
always
Show the command sent.

Sample:
['ping vrf prod 10.40.40.40 count 20 source loopback0']
packet_loss
string
always
Percentage of packets lost.

Sample:
0%
packets_rx
integer
always
Packets successfully received.

Sample:
20
packets_tx
integer
always
Packets successfully transmitted.

Sample:
20
rtt
dictionary
always
Show RTT stats.

Sample:
{'avg': 2, 'max': 8, 'min': 1}


Authors

  • Jacob McGill (@jmcgill298)

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/ansible/netcommon/net_ping_module.html