diff --git a/lib/ansible/executor/process/result.py b/lib/ansible/executor/process/result.py index 4041021b164..0fb06c9b3a2 100644 --- a/lib/ansible/executor/process/result.py +++ b/lib/ansible/executor/process/result.py @@ -107,7 +107,7 @@ class ResultProcess(multiprocessing.Process): # if this task is registering a result, do it now if result._task.register: - self._send_result(('set_host_var', result._host, result._task, None, result._task.register, result._result)) + self._send_result(('register_host_var', result._host, result._task.register, result._result)) # send callbacks, execute other options based on the result status # FIXME: this should all be cleaned up and probably moved to a sub-function. diff --git a/lib/ansible/plugins/strategies/__init__.py b/lib/ansible/plugins/strategies/__init__.py index 0452a7616dd..aff1eadd3b6 100644 --- a/lib/ansible/plugins/strategies/__init__.py +++ b/lib/ansible/plugins/strategies/__init__.py @@ -223,6 +223,14 @@ class StrategyBase: if host not in self._notified_handlers[handler_name]: self._notified_handlers[handler_name].append(host) + elif result[0] == 'register_host_var': + # essentially the same as 'set_host_var' below, however we + # never follow the delegate_to value for registered vars + host = result[1] + var_name = result[2] + var_value = result[3] + self._variable_manager.set_host_variable(host, var_name, var_value) + elif result[0] in ('set_host_var', 'set_host_facts'): host = result[1] task = result[2] diff --git a/test/integration/roles/test_template/tasks/main.yml b/test/integration/roles/test_template/tasks/main.yml index acb6ae91340..a35b93d9d92 100644 --- a/test/integration/roles/test_template/tasks/main.yml +++ b/test/integration/roles/test_template/tasks/main.yml @@ -44,7 +44,7 @@ - name: check what python version ansible is running on command: python -c 'import distutils.sysconfig ; print(distutils.sysconfig.get_python_version())' register: pyver - #delegate_to: localhost + delegate_to: localhost - name: copy known good into place copy: src=foo.txt dest={{output_dir}}/foo.txt