|
|
@ -490,25 +490,19 @@ class StrategyBase:
|
|
|
|
|
|
|
|
|
|
|
|
if 'ansible_facts' in result_item:
|
|
|
|
if 'ansible_facts' in result_item:
|
|
|
|
|
|
|
|
|
|
|
|
if original_task.action == 'include_vars':
|
|
|
|
# if delegated fact and we are delegating facts, we need to change target host for them
|
|
|
|
|
|
|
|
if original_task.delegate_to is not None and original_task.delegate_facts:
|
|
|
|
if original_task.delegate_to is not None:
|
|
|
|
host_list = self.get_delegated_hosts(result_item, original_task)
|
|
|
|
host_list = self.get_delegated_hosts(result_item, original_task)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
host_list = self.get_task_hosts(iterator, original_host, original_task)
|
|
|
|
host_list = self.get_task_hosts(iterator, original_host, original_task)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if original_task.action == 'include_vars':
|
|
|
|
for (var_name, var_value) in iteritems(result_item['ansible_facts']):
|
|
|
|
for (var_name, var_value) in iteritems(result_item['ansible_facts']):
|
|
|
|
# find the host we're actually referring too here, which may
|
|
|
|
# find the host we're actually referring too here, which may
|
|
|
|
# be a host that is not really in inventory at all
|
|
|
|
# be a host that is not really in inventory at all
|
|
|
|
for target_host in host_list:
|
|
|
|
for target_host in host_list:
|
|
|
|
self._variable_manager.set_host_variable(target_host, var_name, var_value)
|
|
|
|
self._variable_manager.set_host_variable(target_host, var_name, var_value)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
# if delegated fact and we are delegating facts, we need to change target host for them
|
|
|
|
|
|
|
|
if original_task.delegate_to is not None and original_task.delegate_facts:
|
|
|
|
|
|
|
|
host_list = self.get_delegated_hosts(result_item, original_task)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
host_list = self.get_task_hosts(iterator, original_host, original_task)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for target_host in host_list:
|
|
|
|
for target_host in host_list:
|
|
|
|
if original_task.action == 'set_fact':
|
|
|
|
if original_task.action == 'set_fact':
|
|
|
|
self._variable_manager.set_nonpersistent_facts(target_host, result_item['ansible_facts'].copy())
|
|
|
|
self._variable_manager.set_nonpersistent_facts(target_host, result_item['ansible_facts'].copy())
|
|
|
|