# feature idea: remember the notified handlers in .retry files on fail/error

**URL:** <https://forum.ansible.com/t/feature-idea-remember-the-notified-handlers-in-retry-files-on-fail-error/13776>\
**Category:** Ansible Developer\
**Created:** [October 26, 2013, 4:17pm UTC](https://forum.ansible.com/t/feature-idea-remember-the-notified-handlers-in-retry-files-on-fail-error/13776 "2013-10-26T16:17:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rene\_Moser](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@Rene\_Moser](https://forum.ansible.com/u/Rene_Moser)\
**Post date:** [October 26, 2013, 4:17pm UTC](https://forum.ansible.com/t/feature-idea-remember-the-notified-handlers-in-retry-files-on-fail-error/13776/1 "2013-10-26T16:17:41Z")

</div>

if ansible fails, ansible creates a retry file. This is nice, but ansible forgets about notified handlers earlier in the play and which should have been executed at the end of the play.

What about executing the handlers even after an error or even better, remember in the retry file the handlers, which should have been executed?

So they would be executed the next time. Something like this would be great.

René

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [October 26, 2013, 4:51pm UTC](https://forum.ansible.com/t/feature-idea-remember-the-notified-handlers-in-retry-files-on-fail-error/13776/2 "2013-10-26T16:51:04Z")

</div>

What’s the use case in which you encountered this problem?

I’m basically talking about specifics to make sure the playbook couldn’t be coded better.

For instance if your handler restarts a service, typically you need a task in there to say:

service: name=foo state=started enabled=yes

To make sure it’s running an enabled and re-running the playbook should correct the problem.

---

<div class="post-metadata">

**Author:** ![Peter\_Gehres](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@Peter\_Gehres](https://forum.ansible.com/u/Peter_Gehres)\
**Post date:** [October 27, 2013, 3:42am UTC](https://forum.ansible.com/t/feature-idea-remember-the-notified-handlers-in-retry-files-on-fail-error/13776/3 "2013-10-27T03:42:41Z")

</div>

If I am reading this correctly, I would also love to see this.

For example, if I update an iptables configuration and notify “iptables reload” but the play fails before the iptables handler executes, the handler is not notified when the play is retried. The handler does not get re-notified on the next play because the configuration didn’t change on the retry play.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 27, 2013, 2:26pm UTC](https://forum.ansible.com/t/feature-idea-remember-the-notified-handlers-in-retry-files-on-fail-error/13776/4 "2013-10-27T14:26:37Z")

</div>

I’m wondering if a way to force all the handlers to fire might solve the use cases around this?

ansible-playbook foo.yml -i retry\_hosts --force-handlers

?

---

<div class="post-metadata">

**Author:** ![Nick\_Groenen](https://avatars.discourse-cdn.com/v4/letter/n/c77e96/32.png) [@Nick\_Groenen](https://forum.ansible.com/u/Nick_Groenen)\
**Post date:** [October 28, 2013, 10:28am UTC](https://forum.ansible.com/t/feature-idea-remember-the-notified-handlers-in-retry-files-on-fail-error/13776/5 "2013-10-28T10:28:15Z")

</div>

+1 to this suggestion, it would be very helpful to me as well.

> For instance if your handler restarts a service, typically you need a task  
> in there to say:
> 
> service: name=foo state=started enabled=yes
> 
> To make sure it's running an enabled and re-running the playbook should  
> correct the problem.

A common idiom is to have Ansible put a configuration file in place,  
then reload/restart the service using that configuration file. You'd  
have a task in there making sure it's started, but when the service is  
already running in the first place, a "service: name=foo state=started  
enabled=yes" would just return OK for that task, thus not correcting  
the problem.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 28, 2013, 12:22pm UTC](https://forum.ansible.com/t/feature-idea-remember-the-notified-handlers-in-retry-files-on-fail-error/13776/6 "2013-10-28T12:22:35Z")

</div>

“This would work. It risks triggering more handlers than necessary, but  
I’d still happily take it over keeping track of which handlers need to  
be run by hand after a failure occurred.”

Can you file a feature ticket for this one?

I think it’s probably the most practical to implement.

Thanks!

---

<div class="post-metadata">

**Author:** ![Rene\_Moser](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@Rene\_Moser](https://forum.ansible.com/u/Rene_Moser)\
**Post date:** [November 1, 2013, 10:59am UTC](https://forum.ansible.com/t/feature-idea-remember-the-notified-handlers-in-retry-files-on-fail-error/13776/7 "2013-11-01T10:59:38Z")

</div>

> Can you file a feature ticket for this one?

[https://github.com/ansible/ansible/issues/4766](https://github.com/ansible/ansible/issues/4766)
