Apply localhost workaround if ansible_host is localhost

This shouldn't really ever happen for real in zuul, but just in case we
do something in a trusted playbook somewhere like setting ansible_host
to localhost, the code should at least do the right thing. (This comes
up more in doing local testing of plugins)

Change-Id: I638fa5f8cd69cd46823ea42bc4e257972d125945
This commit is contained in:
Monty Taylor 2017-07-01 08:39:44 -05:00
parent 9de422f55b
commit 2e8052b40a
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
1 changed files with 3 additions and 0 deletions

View File

@ -172,6 +172,9 @@ class CallbackModule(default.CallbackModule):
ip = play_vars[host].get(
'ansible_host', play_vars[host].get(
'ansible_inventory_host'))
if ip in ('localhost', '127.0.0.1'):
# Don't try to stream from localhost
continue
streamer = threading.Thread(
target=self._read_log, args=(
host, ip, log_id, task_name, hosts))