A common issue I run into is, depending on group or host vars, I might make a configuration change to say php.ini or add php modules and want to reload relevant php services that arent always the same - this might be restarting httpd for mod_php on one host or it might be php-fpm or maybe both if we have nginx installed in front of apache.
I decided to write a meta role for handling this, so I can have this meta-role as dependency in another role and notify it to restart the relevant service if it exists and is running. So if I have a role for making a php change and I want it to reload php-fpm if its installed or httpd if its installed how should I go about this?
What I was trying to do is in the meta role have a few tasks that register variables based on shell command with ps and grep. Then use the result of the variable in the handler with a where clause but thats not allowed in a handler.
Any advice for how I should alternatively approach this?