diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index e4fe7c17e4ca2e..72b4cbc35726ab 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -171,7 +171,11 @@ def _load_handlers(self, attr, ds): Bare handlers outside of a block are given an implicit block. ''' try: - return load_list_of_blocks(ds=ds, play=self, use_handlers=True, variable_manager=self._variable_manager, loader=self._loader) + return self._extend_value( + self.handlers, + load_list_of_blocks(ds=ds, play=self, use_handlers=True, variable_manager=self._variable_manager, loader=self._loader), + prepend=True + ) except AssertionError as e: raise AnsibleParserError("A malformed block was encountered while loading handlers", obj=self._ds, orig_exc=e)