and a way to pass parameters to a notifier. This would need to add a
handler for that combination if it did not exist when it got back that
it had to notify that handler.
I'm open to patches that try to add that. (Not so much the magic
variable though)
No, there isn’t a way to do this exactly as you say.
Each handler must have it’s own name, and the with_items is triggered when the handler is run, it is not something that is used to define the handler multiple times.
You will want to define a handler for each service.
I’m trying to add this same feature, fyi, you need to dedupe name, the hard part that i’m having issues with is when you have with_items on both sides.
I started much like original poster “notify: restart service name=apache” which basically ended up in a notify[‘name’] = set() to which i started appending values, this is not too hard.
with_items at source was pushing me to arrays, which i was having I was trying to dedupe by comparing with previous arrays in notify[‘items’] = , implied with successful items from the task.
Where i got stumped is trying to traverse the items array in a sane manner when service also had with_items, got it working with a Cartesian product, but don’t think this is optimal. I was thinking of adding a group: intersect|product|etc that affects with_items: but this also seems overtly complicated.