ansible.builtin.junos_ping (v2.9.21) — module

Tests reachability using ping from devices running Juniper JUNOS

| "added in version" 2.8 of ansible.builtin"

Authors: Nilashish Chakraborty (@NilashishC)

preview | supported by network

Install Ansible via pip

Install with pip install ansible==2.9.21

Description

Tests reachability using ping from devices running Juniper JUNOS to a remote destination.

Tested against Junos (17.3R1.10)

For a general purpose network module, see the M(net_ping) module.

For Windows targets, use the M(win_ping) module instead.

For targets running Python, use the M(ping) module instead.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test reachability to 10.10.10.10
  junos_ping:
    dest: 10.10.10.10
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test reachability to 10.20.20.20 using source and size set
  junos_ping:
    dest: 10.20.20.20
    size: 1024
    ttl: 128
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test unreachability to 10.30.30.30 using interval
  junos_ping:
    dest: 10.30.30.30
    interval: 3
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test reachability to 10.40.40.40 setting count and interface
  junos_ping:
    dest: 10.40.40.40
    interface: fxp0
    count: 20
    size: 512

Inputs

    
ttl:
    description:
    - The time-to-live value for the ICMP packet(s).
    type: int

dest:
    description:
    - The IP Address or hostname (resolvable by the device) of the remote node.
    required: true

size:
    description:
    - Determines the size (in bytes) of the ping packet(s).
    type: int

count:
    default: 5
    description:
    - Number of packets to send to check reachability.
    type: int

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Determines if the expected result is success or fail.

source:
    description:
    - The IP Address to use while sending the ping packet(s).

interval:
    description:
    - Determines the interval (in seconds) between consecutive pings.
    type: int

provider:
    description:
    - B(Deprecated)
    - 'Starting with Ansible 2.5 we recommend using C(connection: network_cli) or C(connection:
      netconf).'
    - For more information please see the L(Junos OS Platform Options guide, ../network/user_guide/platform_junos.html).
    - HORIZONTALLINE
    - A dict object containing connection details.
    suboptions:
      host:
        description:
        - 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.
        type: str
      password:
        description:
        - 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 C(ANSIBLE_NET_PASSWORD) will
          be used instead.
        type: str
      port:
        description:
        - Specifies the port to use when building the connection to the remote device.  The
          port value will default to the well known SSH port of 22 (for C(transport=cli))
          or port 830 (for C(transport=netconf)) device.
        type: int
      ssh_keyfile:
        description:
        - 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 C(ANSIBLE_NET_SSH_KEYFILE)
          will be used instead.
        type: path
      timeout:
        description:
        - 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.
        type: int
      transport:
        choices:
        - cli
        - netconf
        default: netconf
        description:
        - Configures the transport connection to use when connecting to the remote device.
        type: str
      username:
        description:
        - 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 C(ANSIBLE_NET_USERNAME)
          will be used instead.
        type: str
    type: dict

interface:
    description:
    - The source interface to use while sending the ping packet(s).

Outputs

commands:
  description: List of commands sent.
  returned: always
  sample:
  - ping 10.8.38.44 count 10 source 10.8.38.38 ttl 128
  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: The round trip time (RTT) stats.
  returned: when ping succeeds
  sample:
    avg: 2
    max: 8
    min: 1
    stddev: 24
  type: dict