Error with win_service.ps1

Ansible 1.7.2

First time using any Windows module. I’m using the win_service module as a test, to restart IIS on a development host.

And it fails ‘file does not have a ‘.ps1’ extension.’

windows.hosts

[web]
obfuscatedwebhostname

windows.yml

  • name: iis restart
    win_service:
    name: “w3svc”
    state: “restarted”

$ ansible-playbook -vvvv -i inventory/windows.hosts windows.yml -t iisreset --ask-vault-pass -l web

(some verbosity redacted)

< obfuscatedwebhostname >EXEC PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -File “C:\Users\risadmin\AppData\Local\Temp\ansible-tmp-1428626910.05-80657711681577\win_service.ps1” “C:\Users\risadmin\AppData\Local\Temp\ansible-tmp-1428626910.05-80657711681577\arguments”; Remove-Item "C:\Users\risadmin\AppData\Local\Temp\ansible-tmp-1428626910.05-80657711681577" -Force -Recurse;
<ec2-52-1-123-80.compute-1.amazonaws.com> WINRM EXEC ‘PowerShell’ [‘-NoProfile’, ‘-NonInteractive’, ‘-EncodedCommand’, ‘enoding redacted because life is short’]
<ec2-52-1-123-80.compute-1.amazonaws.com> WINRM RESULT <Response code 0, out “”, err “Processing -File ‘C’”>

failed: [ec2-52-1-123-80.compute-1.amazonaws.com] => {“failed”: true, “parsed”: false}
invalid output was: Processing -File ‘C’ failed because the file does not have a ‘.ps1’ extension. Specify a valid Windows PowerShell script file name, and then try again.

What the what?

Thanks in advance,

~brian

Looks like you have hit: https://github.com/ansible/ansible/issues/8588 which was fixed during 1.8 development.

Are you in a position to try a newer version of ansible?

All the best,

Jon