Windows service status not changing from stoppending to stopped

10 views
Skip to first unread message

amitb...@gmail.com

unread,
Aug 7, 2017, 9:19:00 AM8/7/17
to Ansible Project
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.
Reply all
Reply to author
Forward
0 new messages