Don't look for ansible_host unconditionally

We do this same fallback in other places, and see warnings in the
executor log about hitting this.

Change-Id: Ic9d27a7d3299c8f32fb6d1104dbda4bf5b76c54a
This commit is contained in:
Monty Taylor 2017-07-09 09:55:35 -05:00
parent 1d0bcea15c
commit 9db79043f7
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
1 changed files with 2 additions and 1 deletions

View File

@ -204,7 +204,8 @@ class CallbackModule(default.CallbackModule):
else:
task_host = result._host.get_name()
task_hostvars = result._task._variable_manager._hostvars[task_host]
if task_hostvars['ansible_host'] in localhost_names:
if task_hostvars.get('ansible_host', task_hostvars.get(
'ansible_inventory_host')) in localhost_names:
is_localhost = True
if not is_localhost and is_task: