win_ping issue

I’m having trouble getting win_ping to work. Here is my info:
Fedora 20
Ansible 1.7.1
Remote node running windows 7
The WinRM script by Trond runs without errors on the remote node
Control and Remote Machines are both on Lan with common domain w/o firewalls
So far as I can tell I’ve installed everything on control and remote machine as described in documentation

My inventory file contains
[ads800s]
ADS-6999 ansible_ssh_host=123.123.123.123

My windows.yml file is in the group_vars directory and contains
ansible_ssh_user: ansmgr
ansible_ssh_pass: ansiblepw
ansible_ssh_port: 5986
ansible_connection: winrm

Can you tell what I’m doing wrong? Do you need any more information?

Here is the debugging output of my win_ping command (with -c winrm is below)

[ansmgr@LinuxControlMachine ansible]$ ansible ADS-6999 -m win_ping -vvvv
<123.123.123.123> ESTABLISH CONNECTION FOR USER: ansmgr
<123.123.123.123> REMOTE_MODULE win_ping
<123.123.123.123> EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/home/ansmgr/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘123.123.123.123’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1411567957.01-192759344617423 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1411567957.01-192759344617423 && echo $HOME/.ansible/tmp/ansible-tmp-1411567957.01-192759344617423’”]
ADS-6999 | FAILED => SSH encountered an unknown error. The output was:
OpenSSH_6.4, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 51: Applying options for *
debug1: auto-mux: Trying existing master
debug1: Control socket “/home/ansmgr/.ansible/cp/ansible-ssh-123.123.123.123-22-ansmgr” does not exist
debug2: ssh_connect: needpriv 0
debug1: Connecting to 123.123.123.123 [123.123.123.123] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: connect to address 123.123.123.123 port 22: Connection refused
ssh: connect to host 123.123.123.123 port 22: Connection refused

Here is the debugging output of my win_ping command with -c winrm is below

[ansmgr@LinuxControlMachine ansible]$ ansible ADS-6999 -c winrm -m win_ping -vvvv
<123.123.123.123> ESTABLISH WINRM CONNECTION FOR USER: ansmgr on PORT 5986 TO 123.123.123.123
ADS-6999 | FAILED => Traceback (most recent call last):
File “/usr/lib/python2.7/site-packages/ansible/runner/init.py”, line 561, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File “/usr/lib/python2.7/site-packages/ansible/runner/init.py”, line 666, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File “/usr/lib/python2.7/site-packages/ansible/runner/init.py”, line 837, in _executor_internal_inner
conn = self.connector.connect(actual_host, actual_port, actual_user, actual_pass, actual_transport, actual_private_key_file)
File “/usr/lib/python2.7/site-packages/ansible/runner/connection.py”, line 34, in connect
self.active = conn.connect()
File “/usr/lib/python2.7/site-packages/ansible/runner/connection_plugins/winrm.py”, line 132, in connect
self.protocol = self._winrm_connect()
File “/usr/lib/python2.7/site-packages/ansible/runner/connection_plugins/winrm.py”, line 71, in _winrm_connect
cache_key = ‘%s:%s@%s:%d’ % (self.user, hashlib.md5(self.password).hexdigest(), self.host, port)
TypeError: md5() argument 1 must be string or buffer, not None

It seems as though your group_vars is not being picked up. Is your inventory file and your group_vars directory located in the same place?

By default this is where ansible looks, so both should be in the same directory.

Both the inventory file (hosts) and the group_vars folder are in /etc/ansible

Try not setting the ansible_ssh_host in your inventory - I think this might be forcing it to attempt ssh transport, which of course isn’t going to work for windows hosts.

In other words, change

[ads800s]
ADS-6999 ansible_ssh_host=123.123.123.123

to

ads800s]
ADS-6999

and ensure ADS-6999 can either be resolved by your local dns or as an entry in /etc/hosts

ansible_ssh_host does not imply the transport.

Let’s ask the starter question, “what’s the output of ansible --version” ?

ansible 1.7.1 (this and other details are in the original posting)

Sorry for the confusion, I was replying to the incorrect assertion above and missed the scrollback.

Please make sure you file a ticket for this one as tracebacks in Ansible are definitely bugs, though it sounds like you need to either use --ask-pass or set ansible_ssh_pass – though the variable name is named “ssh” it’s not limited to being used just for SSH.

My windows.yml file is in the group_vars directory and contains

There must be a problem with my encryption because when I run this line in powershell it works.

winrm set winrm/config/service ‘@{AllowUnencrypted=“true”}’

hello,Skinnedknuckles

I ask you how the final solution to the problem? I also encountered this Error, hope you can get your help, thank you very much!

在 2014年9月24日星期三 UTC+8下午10:51:28,skinnedknuckles写道:

check out this post for detailed items to check on your setup

https://groups.google.com/forum/#!topic/ansible-project/DJqUWVnH5Go