title: Ansible Windows Deployment - 'Connection aborted.', error(104, 'Connection reset by peer')
body: <p>I am facing an issue with deployment on Windows 2008 server using Ansible. I have a jenkins pipeline which has an Ansible Deployment stage wherein I drop the files on to the target servers from inventory. I have been able to do this successfully for quite a few servers. However for some servers, I see the above error message. </p>
  
  <p><strong>Here is the output from jenkins pipeline</strong></p>
  
  <pre><code>TASK [debug] *******************************************************************
  ok: [ch3dw026394.mydomain.com] =&gt; {
      "msg": "Hello world!"
  }
  
  TASK [Testing connection to windows] *******************************************
  fatal: [ch3dw026394.mydomain.com]: UNREACHABLE! =&gt; {"changed": false, "msg": "ntlm: ('Connection aborted.', error(104, 'Connection reset by peer'))", "unreachable": true}
  </code></pre>
  
  <p><strong>Here is the Ansible playbook module for win_ping</strong></p>
  
  <pre><code>  #Testing connection with Target
    - debug: 
      msg: "Testing connection to windows {{ inventory_hostname }}"
  
    - name: Testing connection to windows
      win_ping: null
      any_errors_fatal: true
  </code></pre>
  
  <p><strong>I did quite a bit of research on this and none of the following options worked</strong></p>
  
  <ol>
  <li><p>Turned off UAC on the Windows 2008 server. </p></li>
  <li><p>Did not work Some posts
  online said that this error happens because the inventory file does
  not contain FQDN, but contains IP. My inventory file contains FQDN
  (Fully Qualified domain name) and still does not work Another post
  said that the port number(5986) in the vars.yml should be commented
  out and instead have hostname:5986 in the inventory file. Still did
  not work</p></li>
  <li><p>I tried deleting the listeners on the server and ran the powershell
  script to enable WinRM (<a href="https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1" rel="noreferrer">https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1</a>). This also did not work. 
  Deleted the listeners  using        </p>
  
  <pre><code>winrm delete winrm/config/Listener?Address=*+Transport=HTTP
  winrm delete winrm/config/Listener?Address=*+Transport=HTTS
  </code></pre></li>
  <li><p>Set WinRM to have basic Auth = true and also AllowUncrypted = true (see below) and still did not work. (Please note I did not have to do any of this in my other Windows 2008 servers and it worked absolutely fine).</p>
  
  <pre><code>winrm set winrm/config/service '@{AllowUnencrypted= "true"}'
  Set-Item -Path "WSMan:\localhost\Service\Auth\Basic" -Value $true
  </code></pre></li>
  </ol>
  
  <p>Please can you help me get past this error.</p>
  
  <p>Thanks in advance for your assistance!
  Warm Regards</p>