Handling restarting of service in multiple playbook

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!

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.

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.