From 8b5283f547e0f72d8f9f1b876f355d53b0e4a6d4 Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Fri, 22 Jun 2018 13:45:43 +0200 Subject: [PATCH] Template handler name --- lib/ansible/plugins/strategy/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/strategy/__init__.py b/lib/ansible/plugins/strategy/__init__.py index f0c053cb94c..2423eb30fbf 100644 --- a/lib/ansible/plugins/strategy/__init__.py +++ b/lib/ansible/plugins/strategy/__init__.py @@ -831,7 +831,14 @@ class StrategyBase: # we consider the ability of meta tasks to flush handlers for handler in handler_block.block: if handler._uuid in self._notified_handlers and len(self._notified_handlers[handler._uuid]): - result = self._do_handler_run(handler, handler.get_name(), iterator=iterator, play_context=play_context) + handler_vars = self._variable_manager.get_vars(play=iterator._play, task=handler) + templar = Templar(loader=self._loader, variables=handler_vars) + handler_name = handler.get_name() + try: + handler_name = templar.template(handler_name) + except (UndefinedError, AnsibleUndefinedVariable): + pass + result = self._do_handler_run(handler, handler_name, iterator=iterator, play_context=play_context) if not result: break return result