I'm looking for a way to get the list (possibly an ansible system variable) that would contain current handler notifications triggered by a playbook.
In other words, at some point in a role, I would like to add a "when" condition to a task that would test if a "restart notification" has not been sent yet -> do this task when restart is not in the notification list
Any idea ?
Thanks a lot!
I finally came to a solution, quite acceptable, using facts.
I use a handler to set a fact and another one to perform the restart. I associate both of them with the listen parameter to the same notification.
Besides, a reload handler performs the reload only when that fact is not defined or set to false.
I then use where needed, either
Restart Logstash
orReload Logstash
, and only one is performed, restart or reload, but never both.