Ansible stops service but does not restart it
We recently deployed Ansible in different environments and I ran into a problem that I cannot find a solution to.
On two servers, you have to start and stop services by becoming a specific user.
su - itvmgr
Then you need to run a custom command to stop and start the services:
itvmgrctl stop dispatcher itvmgrctl start dispatcher
One of the tasks looks like this:
- name: "Start Dispatcher Service" sudo_user: itvmgr command: su itvmgr -c '/itvmgr/bin/itvmgrctl start dispatcher' - name: Pause pause: seconds=15
There is another task to stop it, which looks just like that, using
The problem I am facing is Ansible stops serving but does not start the service again. I don't get any errors while running, but I can't find any reason why it would stop serving, but the same command won't start it.
If anyone has any suggestions on how I can fix this problem, we would be very grateful.
source to share