help debugging 'Operation not supported on socket'

I have a simple playbook with a ping action. This action works fine on one group of machines, but does not on another. Here is the error:

fatal: [192.168.197.128] => failed to parse: Traceback (most recent call last):

File “//Users/ansible/.ansible/tmp/ansible.AaZh7c/setup”, line 351, in

for (k, v) in ansible_facts().items():

File “//Users/ansible/.ansible/tmp/ansible.AaZh7c/setup”, line 308, in ansible_facts

get_network_facts(facts)

File “//Users/ansible/.ansible/tmp/ansible.AaZh7c/setup”, line 239, in get_network_facts

facts[‘interfaces’] = get_interfaces()

File “//Users/ansible/.ansible/tmp/ansible.AaZh7c/setup”, line 225, in get_interfaces

‘iL’, length, names.buffer_info()[0])

IOError: [Errno 102] Operation not supported on socket

TASK: [push developer.ini to proper location] *********************

no hosts matched or remaining

PLAY RECAP *********************

192.168.197.128 : ok= 0 changed= 0 unreachable= 1 failed= 0

I can ping this ip, and ssh to it using the user specified in the playbook. What else can I do to debug this?

Thanks,
Nathan

So a very useful tool is in the checkout “hacking/test-module”

This will allow you to run the module directly with command line arguments without using all of ansible.

From there, you basically need to debug the Python program either by using prints or pdb.

“Operation does not work on socket” is kind of weird.

What OS and so forth?

(In the worst case, it should catch the exception and just not return interface information, which is what it can be made to do if we can’t root-cause this, but I’d like to do that first)

that sounds good, but how do I pass an ipaddress to ping:

hacking/test-module library/ping

Yeah, you can’t. This is for running the module locally, so you would want to run hacking/testing-module on the affected machine.

It just takes all the ansible automation out of the equation to make it easier to debug the module, it no longer runs things remotely.