Merge pull request #16296 from ccin2p3/hotfix/issue_16295

Properly template task names in free strategy
This commit is contained in:
Matt Davis 2016-06-16 10:53:56 -07:00 committed by GitHub
commit 5900571273

View file

@ -26,6 +26,7 @@ from ansible.playbook.included_file import IncludedFile
from ansible.plugins import action_loader
from ansible.plugins.strategy import StrategyBase
from ansible.template import Templar
from ansible.compat.six import text_type
try:
from __main__ import display
@ -107,6 +108,15 @@ class StrategyModule(StrategyBase):
templar = Templar(loader=self._loader, variables=task_vars)
display.debug("done getting variables")
try:
task.name = text_type(templar.template(task.name, fail_on_undefined=False))
display.debug("done templating")
except:
# just ignore any errors during task name templating,
# we don't care if it just shows the raw name
display.debug("templating failed for some reason")
pass
run_once = templar.template(task.run_once) or action and getattr(action, 'BYPASS_HOST_LOOP', False)
if run_once:
if action and getattr(action, 'BYPASS_HOST_LOOP', False):