Retrieve filtered list of hosts for a task, not all hosts

'play._variable_manager._hostvars' contains all hosts, regardless
of filtering and as such, we might be including more hosts than
expected or necessary.

If we're filtering hosts, either at the play level
(hosts: "group" or hosts: "inventory_hostname") or at the command
level (ansible-playbook -l group), the list of hosts we're interested
in is smaller.

Use 'play._variable_manager._inventory._restriction' which provides
the real parsed/compiled list of hosts involved in the task/play.

Change-Id: Idbc97dd7cca4717f716a7a228a20d85405d1fe7b
diff --git a/zuul/ansible/callback/zuul_stream.py b/zuul/ansible/callback/zuul_stream.py
index a9c1155..4744719 100644
--- a/zuul/ansible/callback/zuul_stream.py
+++ b/zuul/ansible/callback/zuul_stream.py
@@ -484,18 +484,12 @@
     def _get_task_hosts(self, task):
         # If this task has as delegate to, we don't care about the play hosts,
         # we care about the task's delegate target.
-        delegate_to = task.delegate_to
-        if delegate_to:
-            return [delegate_to]
-        hosts = self._play.hosts
-        if 'all' in hosts:
-            # NOTE(jamielennox): play.hosts is purely the list of hosts
-            # that was provided not interpretted by inventory. We don't
-            # have inventory access here but we can assume that 'all' is
-            # everything in hostvars.
-            play_vars = self._play._variable_manager._hostvars
-            hosts = play_vars.keys()
-        return hosts
+        if task.delegate_to:
+            return [task.delegate_to]
+
+        # _restriction returns the parsed/compiled list of hosts after
+        # applying subsets/limits
+        return self.play._variable_manager._inventory._restriction
 
     def _dump_result_dict(self, result_dict):
         result_dict = result_dict.copy()