Ansible unable to ping to windows host error Failed command was: PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand

117 views
Skip to first unread message

arna...@gmail.com

unread,
Oct 13, 2016, 11:10:33 AM10/13/16
to Ansible Project

Hi

When run this ansible command " ansible windows  -m win_ping"  I am  getting the below error , please can anyone help to fix this issue

10.51.239.192 | UNREACHABLE! => {
    "changed": false,
    "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the remote directory. Consider changing the remote temp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand UwBlAHQALQBTAHQAcgBpAGMAdABNAG8AZABlACAALQBWAGUAcgBzAGkAbwBuACAATABhAHQAZQBzAHQACgAoAE4AZQB3AC0ASQB0AGUAbQAgAC0AVAB5AHAAZQAgAEQAaQByAGUAYwB0AG8AcgB5ACAALQBQAGEAdABoACAAJABlAG4AdgA6AHQAZQBtAHAAIAAtAE4AYQBtAGUAIAAiAGEAbgBzAGkAYgBsAGUALQB0AG0AcAAtADEANAA3ADYAMwA2ADYANgAwADEALgA1ADgALQAyADAANwA1ADgANgA1ADMANAA4ADQANgA3ADEAMgAiACkALgBGAHUAbABsAE4AYQBtAGUAIAB8ACAAVwByAGkAdABlAC0ASABvAHMAdAAgAC0AUwBlAHAAYQByAGEAdABvAHIAIAAnACcAOwA=, exited with result 1",
    "unreachable": true
}

I am trying to connect to windows (windows 2012 R2) host ip  10.51.239.192

I have created a windows.yml  under /etc/ansible/group_vars  , below is the connect of the yml file , in my inventory file I have added the ip of this windows host 10.51.239.192

ansible_user: Administrator
ansible_password: P@ssw0rd
ansible_port: 5986
ansible_connection: winrm
# The following is necessary for Python 2.7.9+ when using default WinRM self-signed certificates:
ansible_winrm_server_cert_validation: ignore
#ansible_winrm_transport: ssl

using this same setting I am able to ping to another windows machine which is also windows server 2012

Thanks
Arnab Chowdhury

Matt Davis

unread,
Oct 13, 2016, 11:53:03 AM10/13/16
to Ansible Project
Usually when I've seen that error, it's because Powershell is not on the system path (ie, C:\Windows\System32\WindowsPowerShell\v1.0). Unfortunately the error message comes from a much higher level (a failure creating the tempdir), so the error message isn't specific to failures that might occur on Windows (hence the somewhat misleading text). 
Reply all
Reply to author
Forward
0 new messages