ansible / ansible.builtin / v2.9.17 / module / net_ping Tests reachability using ping from a network device | "added in version" 2.4 of ansible.builtin" Authors: Jacob McGill (@jmcgill298) preview | supported by communityansible.builtin.net_ping (v2.9.17) — module
pip
Install with pip install ansible==2.9.17
Tests reachability using ping from network device to a remote destination.
For Windows targets, use the M(win_ping) module instead.
For targets running Python, use the M(ping) module instead.
- 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
vrf: default: default description: - The VRF to use for forwarding. dest: description: - The IP Address or hostname (resolvable by switch) of the remote node. required: true count: default: 5 description: - Number of packets to send. state: choices: - absent - present default: present description: - Determines if the expected result is success or fail. source: description: - The source IP Address.
commands: description: Show the command sent. returned: always sample: - ping vrf prod 10.40.40.40 count 20 source loopback0 type: list packet_loss: description: Percentage of packets lost. returned: always sample: 0% type: str packets_rx: description: Packets successfully received. returned: always sample: 20 type: int packets_tx: description: Packets successfully transmitted. returned: always sample: 20 type: int rtt: description: Show RTT stats. returned: always sample: avg: 2 max: 8 min: 1 type: dict