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:
<snip>
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:
<ansible.executor.task_result.TaskResult object at 0x198fe90>
24118 1435841636.52295: sending result: ('host_task_failed',
<ansible.executor.task_result.TaskResult object at 0x198fe90>)
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', <ansible.executor.task_result.TaskResult object at
0x1ec2810>)
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 CLEANUP
To 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
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/78119ac9-35ca-4cb5-94ca-59f6e35a07e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.