ping windows - ssl: the specified credentials were rejected by the serve

Hi
I am running ansible 2.1.2.0 on centos7. The windows machine is running windows 10 with powershell 5.
I have installed pywinrm-0.2.2, included windows hostnames in the inventory file and also added group variables to this file for windows.
ansible_user=Administrator
ansible_password=password
ansible_port:=986
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore
I have also run the powershell script on the windows machine and received OK prompt.

I am doing this outside of a domain. If I ping the windows machine from centos outside of ansible I get replies. But with ansible I get

[root@centos7-ansible ~]# ansible mesh -m win_ping -v
Using /etc/ansible/ansible.cfg as config file
mesh | UNREACHABLE! => {
“changed”: false,
“msg”: “ssl: the specified credentials were rejected by the server”,
“unreachable”: true
}

Any ideas what I am doing wrong?

Regards,
John

Hi,

Just a quick suggestion, but the ansible_port you’ve set is not the default. Have you changed it? If not, it should be 5986 not 986.

Johnny :slight_smile:

Thanks for this Johnny.
That was typo in the message. It was

ansible_port:5986

and in my hosts file ([windows:vars] I have it as

ansible_port=5986
but when I edited the copy and paste, I replaced :5 with = rather than just :.

So in summary, the port is right.

Is the host ‘mesh’ a member of a group in your inventory file called ‘windows’?

The group needs to exist in your inventory

so assuming you inventory contains

[windows]
mesh

and you group_vars/windows.yml contains the connection parameters listed above?

If it isn’t then ansible will assume default connection type, which is ssh.

Hope this helps,

Jon

I actually put the connection parameters in /etc/ansible/hosts under [windows:vars].
Is that still valid?

yes, that’s still valid. Here’s a valid and working hosts file:

[all]

[all:vars]
ansible_connection=winrm
ansible_port=5986
ansible_winrm_server_cert_validation=ignore
ansible_password=e6PHLue6PHLu
ansible_user=

[windows]
windows1 ansible_host=192.168.99.100

If that’s not working its likely an issue on the target server. Have you run the prepare-script?

Hi Trond,
I got it to work by changing the user from administrator.
Many thanks for helping.
Regards,
john

I am facing the same Issue. I am using basic authentication , should I use kerberos auth? I am trying to connect to my organisation’s PC.