mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
implemented --step in v2
This commit is contained in:
parent
f6a08ce1ba
commit
88e1ef8c9b
4 changed files with 56 additions and 4 deletions
|
@ -94,6 +94,7 @@ class StrategyModule(StrategyBase):
|
|||
rvals.append((host, noop_task))
|
||||
return rvals
|
||||
|
||||
|
||||
# if any hosts are in ITERATING_SETUP, return the setup task
|
||||
# while all other hosts get a noop
|
||||
if num_setups:
|
||||
|
@ -142,6 +143,10 @@ class StrategyModule(StrategyBase):
|
|||
host_results = []
|
||||
host_tasks = self._get_next_task_lockstep(hosts_left, iterator)
|
||||
|
||||
# skip control
|
||||
skip_rest = False
|
||||
choose_step = True
|
||||
|
||||
for (host, task) in host_tasks:
|
||||
if not task:
|
||||
continue
|
||||
|
@ -149,6 +154,7 @@ class StrategyModule(StrategyBase):
|
|||
run_once = False
|
||||
work_to_do = True
|
||||
|
||||
|
||||
# test to see if the task across all hosts points to an action plugin which
|
||||
# sets BYPASS_HOST_LOOP to true, or if it has run_once enabled. If so, we
|
||||
# will only send this task to the first host in the list.
|
||||
|
@ -183,6 +189,14 @@ class StrategyModule(StrategyBase):
|
|||
else:
|
||||
raise AnsibleError("invalid meta action requested: %s" % meta_action, obj=task._ds)
|
||||
else:
|
||||
# handle step if needed, skip meta actions as they are used internally
|
||||
if self._step and choose_step:
|
||||
if self._take_step(task):
|
||||
choose_step = False
|
||||
else:
|
||||
break
|
||||
skip_rest = True
|
||||
|
||||
self._display.debug("getting variables")
|
||||
task_vars = self._variable_manager.get_vars(loader=self._loader, play=iterator._play, host=host, task=task)
|
||||
task_vars = self.add_tqm_variables(task_vars, play=iterator._play)
|
||||
|
@ -210,6 +224,10 @@ class StrategyModule(StrategyBase):
|
|||
if run_once:
|
||||
break
|
||||
|
||||
# go to next host/task group
|
||||
if skip_rest:
|
||||
continue
|
||||
|
||||
self._display.debug("done queuing things up, now waiting for results queue to drain")
|
||||
results = self._wait_on_pending_results(iterator)
|
||||
host_results.extend(results)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue