Correctly handle assigning results to the delegated to host

This commit is contained in:
James Cammarata
2015-07-07 15:47:51 -04:00
parent 49a148056c
commit 293dd38d05
2 changed files with 29 additions and 12 deletions

View File

@@ -150,11 +150,12 @@ class ResultProcess(multiprocessing.Process):
self._send_result(('add_group', result._host, result_item))
elif 'ansible_facts' in result_item:
# if this task is registering facts, do that now
item = result_item.get('item', None)
if result._task.action in ('set_fact', 'include_vars'):
for (key, value) in result_item['ansible_facts'].iteritems():
self._send_result(('set_host_var', result._host, key, value))
self._send_result(('set_host_var', result._host, result._task, item, key, value))
else:
self._send_result(('set_host_facts', result._host, result_item['ansible_facts']))
self._send_result(('set_host_facts', result._host, result._task, item, result_item['ansible_facts']))
# finally, send the ok for this task
self._send_result(('host_task_ok', result))