mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
parent
6e56a61535
commit
6b46cc5c73
5 changed files with 29 additions and 6 deletions
|
@ -918,3 +918,11 @@ class StrategyBase:
|
|||
display.vv("META: %s" % msg)
|
||||
|
||||
return [TaskResult(target_host, task, result)]
|
||||
|
||||
def get_hosts_left(self, iterator):
|
||||
|
||||
hosts_left = []
|
||||
for host in self._inventory.get_hosts(iterator._play.hosts, order=iterator._play.order):
|
||||
if host.name not in self._tqm._unreachable_hosts:
|
||||
hosts_left.append(host)
|
||||
return hosts_left
|
||||
|
|
|
@ -61,7 +61,8 @@ class StrategyModule(StrategyBase):
|
|||
work_to_do = True
|
||||
while work_to_do and not self._tqm._terminated:
|
||||
|
||||
hosts_left = [host for host in self._inventory.get_hosts(iterator._play.hosts) if host.name not in self._tqm._unreachable_hosts]
|
||||
hosts_left = self.get_hosts_left(iterator)
|
||||
|
||||
if len(hosts_left) == 0:
|
||||
self._tqm.send_callback('v2_playbook_on_no_hosts_remaining')
|
||||
result = False
|
||||
|
|
|
@ -167,7 +167,7 @@ class StrategyModule(StrategyBase):
|
|||
|
||||
try:
|
||||
display.debug("getting the remaining hosts for this loop")
|
||||
hosts_left = [host for host in self._inventory.get_hosts(iterator._play.hosts) if host.name not in self._tqm._unreachable_hosts]
|
||||
hosts_left = self.get_hosts_left(iterator)
|
||||
display.debug("done getting the remaining hosts for this loop")
|
||||
|
||||
# queue up this task for each host in the inventory
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue