Test connectivity from AWX to devices in inventory

Hi All,

I’m trying to figure out how to test IP connectivity between AWX and a large list of network devices. I know that SSH connectivity will be blocked so using the ping module will fail. I tried to use the command module as below

tasks:

  • name: “Test for IP reachbility to inventory target”
    shell: ping -c1 {{ ansible_host }}
    delegate_to: localhost

With the following results
fatal: [router1 → localhost]: FAILED! => {“changed”: true, “cmd”: “ping -c1 192.168.100.1”, “delta”: “0:00:10.011693”, “end”: “2020-06-19 13:37:10.906005”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2020-06-19 13:37:00.894312”, “stderr”: “”, “stderr_lines”: , “stdout”: “PING 192.168.100.1 (192.168.100.1) 56(84) bytes of data.\n\n— 192.168.100.1 ping statistics —\n1 packets transmitted, 0 received, 100% packet loss, time 0ms”, “stdout_lines”: [“PING 192.168.100.1 (192.168.100.1) 56(84) bytes of data.”, “”, “— 192.168.100.1 ping statistics —”, “1 packets transmitted, 0 received, 100% packet loss, time 0ms”]}

When log into the awx_task container and execute the same ping command from a bash shell it succeeds
bash-4.4# ping -c1 192.168.100.1
PING 192.168.100.1 (192.168.100.1) 56(84) bytes of data.
64 bytes from 192.168.100.1: icmp_seq=1 ttl=246 time=1.55 ms

— 192.168.100.1 ping statistics —
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.551/1.551/1.551/0.000 ms
bash-4.4#

Does AWX set up some sort of restricted environment where tasks that are delegated to localhost are executed from? Is there anything that I can execute an equivalent task that is not bound by these restrictions?

Rod

As you are running as ansible command, please use ssh proxy parameter in extra var section.

Hi Selvam,

I don’t really understand your suggestion. The intention is to run the command on the awx_task container which is why I set “delegate_to: localhost” I don’t want to run it via SSH.

Best regards

Rod