While executing my playbook, I cancelled the playbook execution when 
win_service task for stopping a service was in play. When I re-ran the 
playbook, it failed to stop the windows service. The windows service status 
was changed from "running" to "stoppending" after the first playbook 
execution. The status of the service is displayed as "Stopping" on the 
windows machine.

The code snippet from my playbook is as below:-

- hosts: all
  gather_facts: no
  tasks:
    - name: Service 'XYZ' exists?
      win_service:
        name: XYZ
      register: XYZ_service
    
    - name: Stop 'XYZ' service
      win_service:
        name: XYZ
        state: stopped
      when: XYZ_service.exists


Is this an expected behavior? 

Please provide a solution this problem.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fb474414-b36d-41aa-8abd-7707e62c8217%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to