From 9c3447c61945409ffc0a9de50408f8260be253f0 Mon Sep 17 00:00:00 2001 From: Remi Ferrand Date: Wed, 15 Jun 2016 09:49:04 +0200 Subject: [PATCH] Properly template task names in free strategy * Fixes #16295 --- lib/ansible/plugins/strategy/free.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ansible/plugins/strategy/free.py b/lib/ansible/plugins/strategy/free.py index ae8370d5fba..89287c49ab3 100644 --- a/lib/ansible/plugins/strategy/free.py +++ b/lib/ansible/plugins/strategy/free.py @@ -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):