The term '/bin/sh' is not recognized as the name of a cmdlet - PowerShell

I’m testing managing a windows box from an Ubuntu trusty.

This WORKS!
ansible windows -i inventory/vagrant.ini -m win_ping -vvv

This WORKS too!
windows -i inventory/vagrant.ini -m setup -vvv

But when i run the actual play, it fails :frowning: help please…!

ansible-playbook site.yaml -i inventory/vagrant.ini --limit windows --diff -vvv
Using /home/aomoware/Documents/git_repos/monitoring_environment/ansible.cfg as config file
1 plays in site.yaml

PLAY ***************************************************************************

TASK [setup] *******************************************************************
<10.12.64.80> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 10.12.64.80
<10.12.64.80> EXEC Set-StrictMode -Version Latest
(New-Item -Type Directory -Path $env:temp -Name “ansible-tmp-1457523740.58-78594312158152”).FullName | Write-Host -Separator ‘’;
<10.12.64.80> PUT “/tmp/tmpkiGGuO” TO “C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1457523740.58-78594312158152\setup.ps1”
<10.12.64.80> EXEC /bin/sh -c ‘sudo -H -S -n -u root /bin/sh -c ‘"’“‘echo BECOME-SUCCESS-nilzukhxwbbvvigfqtfxxfkueclxexhc; PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand UwBlAHQALQBTAHQAcgBpAGMAdABNAG8AZABlACAALQBWAGUAcgBzAGkAbwBuACAATABhAHQAZQBzAHQACgBUAHIAeQAKAHsACgAmACAAIgBDADoAXABVAHMAZQByAHMAXABBAGQAbQBpAG4AaQBzAHQAcgBhAHQAbwByAFwAQQBwAHAARABhAHQAYQBcAEwAbwBjAGEAbABcAFQAZQBtAHAAXABhAG4AcwBpAGIAbABlAC0AdABtAHAALQAxADQANQA3ADUAMgAzADcANAAwAC4ANQA4AC0ANwA4ADUAOQA0ADMAMQAyADEANQA4ADEANQAyAFwAcwBlAHQAdQBwAC4AcABzADEAIgAKAH0ACgBDAGEAdABjAGgACgB7AAoAJABfAG8AYgBqACAAPQAgAEAAewAgAGYAYQBpAGwAZQBkACAAPQAgAC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4AIAAtAEMAbwBtAHAAcgBlAHMAcwAgAC0ARABlAHAAdABoACAAOQA5AAoARQB4AGkAdAAgADEACgB9AAoARgBpAG4AYQBsAGwAeQAgAHsAIABSAGUAbQBvAHYAZQAtAEkAdABlAG0AIAAiAEMAOgBcAFUAcwBlAHIAcwBcAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAXABBAHAAcABEAGEAdABhAFwATABvAGMAYQBsAFwAVABlAG0AcABcAGEAbgBzAGkAYgBsAGUALQB0AG0AcAAtADEANAA1ADcANQAyADMANwA0ADAALgA1ADgALQA3ADgANQA5ADQAMwAxADIAMQA1ADgAMQA1ADIAIgAgAC0ARgBvAHIAYwBlACAALQBSAGUAYwB1AHIAcwBlACAALQBFAHIAcgBvAHIAQQBjAHQAaQBvAG4AIABTAGkAbABlAG4AdABsAHkAQwBvAG4AdABpAG4AdQBlACAAfQA=’”’“‘’
fatal: [netmon-2]: FAILED! => {“changed”: false, “failed”: true, “invocation”: {“module_name”: “setup”}, “module_stderr”: “#< CLIXML\r\n<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04\”><S S="Error">/bin/sh : The term ‘/bin/sh’ is not recognized as the name of a cmdlet, x000D__x000A<S S="Error">function, script file, or operable program. Check the spelling of the name, or x000D__x000A<S S="Error">if a path was included, verify that the path is correct and try again.x000D__x000A<S S="Error">At line:1 char:1_x000D__x000A_<S S="Error">+ /bin/sh -c 'sudo -H -S -n -u root /bin/sh -c ‘"’"'echo x000D__x000A<S S="Error">BECOME-SUCCESS-nilzukhxwb …x000D__x000A<S S="Error">+ ~~~~~~~x000D__x000A<S S="Error"> + CategoryInfo : ObjectNotFound: (/bin/sh:String) , CommandNotF x000D__x000A<S S="Error"> oundException_x000D__x000A_<S S="Error"> + FullyQualifiedErrorId : CommandNotFoundException_x000D__x000A_<S S="Error"> x000D__x000A”, “module_stdout”: “”, “msg”: “MODULE FAILURE”, “parsed”: false}

NO MORE HOSTS LEFT *************************************************************
to retry, use: --limit @site.retry

PLAY RECAP *********************************************************************
netmon-2 : ok=0 changed=0 unreachable=0 failed=1

Can you share your ansible.cfg differences between a clean ansible.cfg?

Looks like the result of some sudo/become settings are getting added to your setup module invocation on the windows box and confusing things.

Jon