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