diff --git a/changelogs/fragments/include-double-handler.yaml b/changelogs/fragments/include-double-handler.yaml new file mode 100644 index 00000000000..96b4836a187 --- /dev/null +++ b/changelogs/fragments/include-double-handler.yaml @@ -0,0 +1,2 @@ +bugfixes: +- includes - ensure we do not double register handlers from includes to prevent exception (https://github.com/ansible/ansible/issues/44848) diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index 44372074050..9d519a1b953 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -239,6 +239,8 @@ class Play(Base, Taggable, Become): if len(self.roles) > 0: for r in self.roles: + if r.from_include: + continue block_list.extend(r.get_handler_blocks(play=self)) return block_list