ansible.netcommon.net_ping module – Tests reachability using ping from a network device
Note
This module is part of the ansible.netcommon collection (version 6.1.3).
You might already have this collection installed if you are using the ansible
package. It is not included in ansible-core
. To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install ansible.netcommon
.
To use it in a playbook, specify: ansible.netcommon.net_ping
.
New in ansible.netcommon 1.0.0
Synopsis
- Tests reachability using ping from network device to a remote destination.
Note
This module has a corresponding action plugin.
Parameters
Parameter | Comments |
---|---|
count string | Number of packets to send. Default: |
dest string / required | The IP Address or hostname (resolvable by switch) of the remote node. |
source string | The source IP Address. |
state string | Determines if the expected result is success or fail. Choices:
|
vrf string | The VRF to use for forwarding. Default: |
Notes
Note
- For targets running Python, use the ansible.builtin.shell module along with ping command instead.
- This module is supported on
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
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
---|---|
commands list / elements=string | Show the command sent. Returned: always Sample: |
packet_loss string | Percentage of packets lost. Returned: always Sample: |
packets_rx integer | Packets successfully received. Returned: always Sample: |
packets_tx integer | Packets successfully transmitted. Returned: always Sample: |
rtt dictionary | Show RTT stats. Returned: always Sample: |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2024 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/ansible/netcommon/net_ping_module.html