# Handling restarting of service in multiple playbook

**URL:** <https://forum.ansible.com/t/handling-restarting-of-service-in-multiple-playbook/12771>\
**Category:** Ansible Project\
**Created:** [May 6, 2013, 2:13am UTC](https://forum.ansible.com/t/handling-restarting-of-service-in-multiple-playbook/12771 "2013-05-06T02:13:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nora\_Olsen](https://avatars.discourse-cdn.com/v4/letter/n/57b2e6/32.png) [@Nora\_Olsen](https://forum.ansible.com/u/Nora_Olsen)\
**Post date:** [May 6, 2013, 2:13am UTC](https://forum.ansible.com/t/handling-restarting-of-service-in-multiple-playbook/12771/1 "2013-05-06T02:13:38Z")

</div>

Hi,

I have supervisord that is use to control multiple processes. I have a a playbook to configure each process and they write out the necessary supervisor conf files for the “include” section:

> [include]
> 
> files = /etc/supervisor/conf.d/\*.con

Is it possible to only restart supervisor once or will they restart multiple times when I register the notify handler?

Thanks!

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [May 6, 2013, 2:31am UTC](https://forum.ansible.com/t/handling-restarting-of-service-in-multiple-playbook/12771/2 "2013-05-06T02:31:01Z")

</div>

You could setup a play you run at the end with a task that restart depending on a custom fact (ansible\_must\_restart\_super) you can set with set\_fact as a handler in each play or by keeping a md5 of previous run or just looking at the timestamp or a flag file.

---

<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:** [May 6, 2013, 12:17pm UTC](https://forum.ansible.com/t/handling-restarting-of-service-in-multiple-playbook/12771/3 "2013-05-06T12:17:04Z")

</div>

That would do it, but you’d have to see if it were defined, and you probably would have to use multiple register statements. Sounds a bit awkard that way.

I would suggest getting things down into one play and instead of having multiple playbooks, such as using task includes, or (cleaner) roles in 1.2.

Handlers in plays run at the end of the play, and in 1.2, also between the pre\_tasks, main (roles+tasks), and post\_tasks sections.
