I have Windows server that have an EXE pushed to them via Ansible, and then that EXE is associated with a Windows Service (also via Ansible).
So the playbook goes:
Copy EXE to host (win_copy)
Create and start service (win_service)
The problem:
Once the service is running, that EXE is now in use. If I need to push out a new EXE, I need to stop the service first. I need the workflow to be:
If EXE has changed, then stop service BEFORE copying EXE.
The “Create and start service” task should then ensure the service is started again if it was stopped, so that can stay the same.
I guess I need a “reverse handler” of sorts? Instead of executing a handler after a change, I need to execute a handler before a change.