Connecting to Azure Win Servers

Hi

I have setup some Windows servers is Azure, and now want to run some playbooks to those servers.

I am getting the following error though (see attached).

10.85.50.8 | FAILED! => {

“failed”: true,

“msg”: “ERROR! ssl: 500 WinRMTransport. [Errno 104] Connection reset by peer”

}

  • I have disabled Windows firewall on all those servers, and I have also run the ‘ansible.ps1’ file to enable everything on a Windows server.

  • I have also allowed all incoming traffic on the Azure network

Is there something that Ansible Needs to be done in order to access servers in Azure?

If I run the win_ping command directly from the Ansible server, I get the following error:

10.85.50.9 | UNREACHABLE! => {

“changed”: false,

“msg”: “ERROR! SSH encountered an unknown error. The output was:\nOpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 56: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: Control socket "/root/.ansible/cp/ansible-ssh-10.85.50.9-22-root" does not exist\r\ndebug2: ssh_connect: needpriv 0\r\ndebug1: Connecting to 10.85.50.9 [10.85.50.9] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 10.85.50.9 port 22: Connection timed out\r\nssh: connect to host 10.85.50.9 port 22: Connection timed out\r\n”,

“unreachable”: true

Hmm, looks like it is trying to make an SSH connection, rather than a WinRM connection Port 22 is the giveaway there - should be 5985 or 5986 for winrm.

I suggest checking your inventory/group vars to make sure you have ansible_connection: winrm

set in your inventory or group vars for this host.

Hope this helps,

Jon