Minor tweak to potentially speed the linear strategy up

* Don't fetch vars for the task unless we're going to use them
pull/11350/head
James Cammarata 10 years ago
parent f17bdc4d61
commit 97954ff658

@ -165,11 +165,6 @@ class StrategyModule(StrategyBase):
# corresponding action plugin # corresponding action plugin
pass pass
debug("getting variables")
task_vars = self._variable_manager.get_vars(loader=self._loader, play=iterator._play, host=host, task=task)
templar = Templar(loader=self._loader, variables=task_vars)
debug("done getting variables")
# check to see if this task should be skipped, due to it being a member of a # check to see if this task should be skipped, due to it being a member of a
# role which has already run (and whether that role allows duplicate execution) # role which has already run (and whether that role allows duplicate execution)
if task._role and task._role.has_run(): if task._role and task._role.has_run():
@ -191,6 +186,11 @@ class StrategyModule(StrategyBase):
else: else:
raise AnsibleError("invalid meta action requested: %s" % meta_action, obj=task._ds) raise AnsibleError("invalid meta action requested: %s" % meta_action, obj=task._ds)
else: else:
debug("getting variables")
task_vars = self._variable_manager.get_vars(loader=self._loader, play=iterator._play, host=host, task=task)
templar = Templar(loader=self._loader, variables=task_vars)
debug("done getting variables")
if not callback_sent: if not callback_sent:
temp_task = task.copy() temp_task = task.copy()
temp_task.name = templar.template(temp_task.get_name(), fail_on_undefined=False) temp_task.name = templar.template(temp_task.get_name(), fail_on_undefined=False)

Loading…
Cancel
Save