junos_ping - execute ping on junos devices

Author:Damien Garros, Juniper Networks

Synopsis

New in version 1.3.1.

execute ping on junos devices

Options

parameter required default choices comments
acceptable_packet_loss no 0
    Number of packets lost that is acceptable to consider the test PASS
    count no 5
      Number of packet to send
      dest_ip yes
        Destination ip
        host yes
          Set to {{ inventory_hostname }}
          interface no
            Interface used to send traffic out
            mode no None
              mode of console connection (telnet/serial). If mode is not provided SSH connection is used.
              passwd no assumes ssh-key active
                Login password
                port no 830
                  port number to use when connecting to the device
                  rapid no True
                    Execute ping at 100pps instead of 1pps
                    routing_instance no
                      Name of the routing instance to use to send the ping
                      source_ip no
                        Source IP used to send the ping
                        ssh_private_key_file no None
                          This can be used if you need to provide a private key rather than loading the key into the ssh-key-ring/environment. if your ssh-key requires a password, then you must provide it via **passwd**
                          timeout no 0
                            Extend the NETCONF RPC timeout beyond the default value of 30 seconds. Set this value to accommodate pings that might take longer than the default timeout interval.
                            ttl no
                              Maximum number of IP routers (IP hops) allowed between source and destination
                              user no $USER
                                Login username

                                Note

                                Requires junos-eznc >= 1.2.2

                                Examples


                                # Simple example
                                  tasks:
                                    - name: "Execute ping peer"
                                      junos_ping:
                                        host={{ junos_host }}
                                        port={{ netconf_port }}
                                        user={{ ansible_ssh_user }}
                                        passwd={{ ansible_ssh_pass }}
                                        dest_ip=8.8.8.8
                                
                                # ping over console server connection using PyEZ >= 2.0
                                  tasks:
                                    - name: "Execute ping peer"
                                      junos_ping:
                                        host={{ inventory_hostname }}
                                        port=2011
                                        mode='telnet'
                                        user={{ ansible_ssh_user }}
                                        passwd={{ ansible_ssh_pass }}
                                        dest_ip=8.8.8.8
                                
                                # Using loop and more parameters
                                  tasks:
                                    - name: "Execute ping peer"
                                      junos_ping:
                                        host={{ junos_host }}
                                        port={{ netconf_port }}
                                        user={{ ansible_ssh_user }}
                                        passwd={{ ansible_ssh_pass }}
                                        dest_ip={{ item.peer_ip }}
                                        source_ip={{ item.local_ip }}
                                        ttl=1
                                      with_items: "{{underlay.neighbors}}"