mhutter / ansible-docker-systemd-service

Ansible role for creating Systemd services for docker containers
https://galaxy.ansible.com/mhutter/docker-systemd-service
MIT License
48 stars 30 forks source link

handler not found when using include_role #34

Open gnalsa opened 3 years ago

gnalsa commented 3 years ago

Hello, I have found there is an open issue against ansible for handlers not working when using include_role - See https://github.com/ansible/ansible/issues/20493 It was documented as a Note in the documentation until it is addressed: https://github.com/ansible/ansible/pull/72744

In my case I am getting the following error that the handler does not exist

TASK [mhutter.docker-systemd-service : Create unit myapp-instance1_container.service] ****************************************************************************************************************************************************************************
ERROR! The requested handler 'restart container myapp-instance1' was not found in either the main handlers list nor in the listening handlers list

Has anyone else faced this problem?

mhutter commented 3 years ago

Hmm, a possible workaround would be a task that runs conditionally, but implementing and then maintaining this is a PITA...

Is this specific to certain Versions of Ansible?

andygrunwald commented 2 years ago

I run into the same issue. I have my own role and add this role via include_role.

I am running ansible 2.9.27 As far as I understand https://github.com/ansible/ansible/issues/20493 this is not bound to any specific ansible version.

andygrunwald commented 2 years ago

After some reading, I am not 100% sure if https://github.com/ansible/ansible/issues/20493 is the issue. https://github.com/ansible/ansible/issues/20493 talks about calling include_role inside a handler.

But I am facing the issue once this role is included as a task inside another role. It seems more related to https://github.com/ansible/ansible/issues/31071

epou commented 1 year ago

Fix proposed in https://github.com/mhutter/ansible-docker-systemd-service/pull/61