This app1 is built in house and deployed to a local yum repo managed by jenkins, so every time I run the “common” role it gets updated to the latest version. As a result when the ‘application’ role runs my ‘app1’ no longer needs to be updated so my restart app1 handler never gets executed.
Any ideas how to ‘fix this’ ?
Today I am simply restarting app1 every time I run ansible on this host which is not ideal.
You can always define and maintain a list variable with the excluded packages. Then, you may make your task look like this: Or create /etc/yum.conf from a template with an equivalent ‘exclude={{ excluded_packages|join(’ ‘) }}’ line in its [main] section.
I’d normally have the RPM do the work of restarting after installation (upgrade), at least if it’s always to be done, and is a safe thing. Given your role above, that seems to be true… If so, you would only need the “common” role.
Now, if you need to reconfigure stuff after installing the application, then you would of course put that in a separate role, and notify after changing the config so the app will get restarted.
I deploy the configuration for the app through a different task, which doesn’t change very often.
caking the RPM-initscripts to restart the app looks like the cleanest way forward.
Are your in-house app RPMs in a custom yum repo? Because you could very easily exclude that and do your system upgrade by using the yum module rather than shell: