From b1211429d5a493c55914d9a97257859fe7d1208c Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Tue, 12 Oct 2021 18:15:37 +0200 Subject: Fix executing includes in the free strategy (#75649) Fixes #75642 --- lib/ansible/plugins/strategy/free.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/ansible/plugins') diff --git a/lib/ansible/plugins/strategy/free.py b/lib/ansible/plugins/strategy/free.py index 7e0406984d..326c347ad3 100644 --- a/lib/ansible/plugins/strategy/free.py +++ b/lib/ansible/plugins/strategy/free.py @@ -120,17 +120,19 @@ class StrategyModule(StrategyBase): (state, task) = iterator.get_next_task_for_host(host, peek=True) display.debug("free host state: %s" % state, host=host_name) display.debug("free host task: %s" % task, host=host_name) - if host_name not in self._tqm._unreachable_hosts and task: + # check if there is work to do, either there is a task or the host is still blocked which could + # mean that it is processing an include task and after its result is processed there might be + # more tasks to run + if (task or self._blocked_hosts.get(host_name, False)) and not self._tqm._unreachable_hosts.get(host_name, False): + display.debug("this host has work to do", host=host_name) # set the flag so the outer loop knows we've still found # some work which needs to be done work_to_do = True - display.debug("this host has work to do", host=host_name) - + if not self._tqm._unreachable_hosts.get(host_name, False) and task: # check to see if this host is blocked (still executing a previous task) - if (host_name not in self._blocked_hosts or not self._blocked_hosts[host_name]): - + if not self._blocked_hosts.get(host_name, False): display.debug("getting variables", host=host_name) task_vars = self._variable_manager.get_vars(play=iterator._play, host=host, task=task, _hosts=self._hosts_cache, -- cgit v1.2.1