WINRM: Getting the Error Message when used the win_service to stopped the services

Hi Team,

I am getting the error when trying to stopped some window services using the win_service module.

TASK [Gathering Facts] ***************************************************************************
Using module file /usr/local/lib/python2.7/site-packages/ansible/modules/windows/setup.ps1
ESTABLISH WINRM CONNECTION FOR USER: username on PORT 5986 TO
EXEC (via pipeline wrapper)
fatal: [servername.com]: FAILED! => {
“changed”: false,
“failed”: true,
“module_stderr”: “”,
“module_stdout”: “”,
“msg”: “MODULE FAILURE”,
“rc”: 0
}
to retry, use: --limit @/home/username/windows/firt.retry

PLAY RECAP ***************************************************************************************
server.com : ok=0 changed=0 unreachable=0 failed=1

But when i checked on node side, the services is stopped. (Means in run time gets the error). Same time start module working fine.

Please help me to fix this.

Regards
Shtrudhan Kumar

Can you run with verbose output on and see if you get more error information?

You don’t mention which version of ansible you are using, but I think in older versions this module would fail if the service doesn’t exist. Make sure you are using the service name in your playbook.

If in doubt what the service name is, run

Get-Service

in powershell on the windows machine. This will show the state, name and display name of each service.

Hope this helps,

Jon

Hi Jon,

The Ansible version is 2.4. The service is exits.
I guess the error come, while stopping the services took some more time. I have observed this when manually tried to stop the service on node side.

is there any way to increase the default time ?

Regards
Shtrudhan Kumar