Hi,
I’m new to Ansible, so might be asking a slightly silly question here. I’ve just started setting up an environment based on the development version (sha 08ad05c) and did the obvious “hello world test”:
$ ansible all -i inventory -m ping
The result was… nothing. A bit confusing, so I intentionally set the wrong host in my inventory, and got the same result. Adding -vvvv doesn’t produce any output, and I had to dig around with traceback.print_stack and ANSIBLE_DEBUG=True to figure out what was going on. It turns out that I don’t have paths set up correctly for Paramiko. I’ll fix that myself in a minute, but the error handling doesn’t seem to be working properly? (Or at least, it’s distinctly unhelpful)
With ANSIBLE_DEBUG=True, I see:
24113 1435841636.49516: done running TaskExecutor() for evm0/TASK: ping 24113 1435841636.49518: sending task result 24113 1435841636.49561: done sending task result 24108 1435841636.50319: waiting for pending results (1 left) 24108 1435841636.51335: waiting for pending results (1 left) 24118 1435841636.52105: worker 1 has data to read 24118 1435841636.52285: got a result from worker 1: 24118 1435841636.52295: sending result: ('host_task_failed', ) 24118 1435841636.52352: done sending result 24108 1435841636.52357: waiting for pending results (1 left) 24108 1435841636.53373: waiting for pending results (1 left) 24108 1435841636.53505: got result from result worker: ('host_task_failed', ) 24108 1435841636.53514: marking evm0 as failed 24108 1435841636.54546: results queue empty 24108 1435841636.54547: getting the remaining hosts for this loop 24108 1435841636.54558: done getting the remaining hosts for this loop 24108 1435841636.54617: done queuing things up, now waiting for results queue to drain 24108 1435841636.54619: results queue empty 24108 1435841636.54620: running handlers 24108 1435841636.54630: RUNNING CLEANUPTo figure out what was going wrong, I eventually found TaskExecutor’s run() method in executor/task_executor.py and printed the error it was catching.
The error message gets bundled up into the TaskResult that we can see being passed around above. This makes it as far upwards as the run method of StrategyModule in plugins/strategies/linear.py. There it is added to a variable called host_results. Since the result isn’t an “include result” (which I don’t know much about), the call to process_include_results() doesn’t do anything. And then the result is discarded.
Should the user have some way of telling that the command failed? Or am I using the tool wrong?
Rupert