ios_ping - Tests reachability using ping from IOS switch

New in version 2.4.

Synopsis

  • Tests reachability using ping from switch to a remote destination.

Options

parameter required default choices comments
auth_pass
no none
Specifies the password to use if required to enter privileged mode on the remote device. If authorize is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_AUTH_PASS will be used instead.
authorize
no
  • yes
  • no
Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_AUTHORIZE will be used instead.
count
no 5
Number of packets to send.
dest
yes
The IP Address or hostname (resolvable by switch) of the remote node.
provider
no
A dict object containing connection details.
Dictionary object provider
parameter required default choices comments
username
no
Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.
authorize
no
  • yes
  • no
Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_AUTHORIZE will be used instead.
ssh_keyfile
no
Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_SSH_KEYFILE will be used instead.
auth_pass
no none
Specifies the password to use if required to enter privileged mode on the remote device. If authorize is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_AUTH_PASS will be used instead.
host
yes
Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.
timeout
no 10
Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error.
password
no
Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.
port
no 22
Specifies the port to use when building the connection to the remote device.
source
no
The source IP Address.
state
no present
  • absent
  • present
Determines if the expected result is success or fail.
vrf
no default
The VRF to use for forwarding.

Examples

- provider:
    host: "{{ ansible_host }}"
    username: "{{ username }}"
    password: "{{ password }}"

- name: Test reachability to 10.10.10.10 using default vrf
  ios_ping:
    provider: "{{ provider }}"
    dest: 10.10.10.10

- name: Test reachability to 10.20.20.20 using prod vrf
  ios_ping:
    provider: "{{ provider }}"
    dest: 10.20.20.20
    vrf: prod

- name: Test unreachability to 10.30.30.30 using default vrf
  ios_ping:
    provider: "{{ provider }}"
    dest: 10.30.30.30
    state: absent

- name: Test reachability to 10.40.40.40 using prod vrf and setting count and source
  ios_ping:
    provider: "{{ provider }}"
    dest: 10.40.40.40
    source: loopback0
    vrf: prod
    count: 20

Return Values

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

name description returned type sample
commands
Show the command sent.
always list ['ping vrf prod 10.40.40.40 count 20 source loopback0']
packet_loss
Percentage of packets lost.
always str 0%
packets_rx
Packets successfully received.
always int 20
packets_tx
Packets successfully transmitted.
always int 20
rtt
Show RTT stats.
always dict {'max': 8, 'avg': 2, 'min': 1}

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

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