title: Unable to connect to a Windows Instance using Ansible Playbook
body: <p>Every time I try running a playbook to automate some installations in <strong>Windows Server</strong>, my Windows Remote Host seems to be <strong>unreachable</strong>.</p>
  
  <p>Here, I am trying to install IIS Server and my <strong>playbook</strong> looks like this :</p>
  
  <pre><code>---
  - hosts : windows
    tasks :
  - name : Install Microsoft IIS
    win_feature :
      name : Web-Server
      state : present
  </code></pre>
  
  <p>And the <strong>error</strong> is :</p>
  
  <pre><code>fatal: [ec2-54-197-197-91.compute-1.amazonaws.com]: UNREACHABLE! =&gt; {
  "changed": false,
  "msg": "ssl: HTTPSConnectionPool(host='ec2-54-197-197-91.compute-1.amazonaws.com', port=5986): Max retries exceeded with url: /wsman (Caused by ConnectTimeoutError(&lt;requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x1b11310&gt;, 'Connection to ec2-54-197-197-91.compute-1.amazonaws.com timed out. (connect timeout=30)'))",
  "unreachable": true
  }
  </code></pre>
  
  <p>But, now I came to know that, to run playbooks for Windows, I need to have <strong>winrm</strong> installed on my control node.</p>
  
  <p>I have done the following :</p>
  
  <pre><code>pip install "pywinrm&gt;=0.1.1"
  </code></pre>
  
  <p>I have added the public ip of Windows Instance and my <strong>hosts file</strong> looks like:</p>
  
  <pre><code>[local]
  127.0.0.1
  
  [aws]
  ec2-54-152-85-197.compute-1.amazonaws.com
  
  [windows]
  ec2-54-197-197-91.compute-1.amazonaws.com
  </code></pre>
  
  <p>Then, I created a directory <strong>"group_vars"</strong> in <strong>/etc/ansible</strong>, and in that a file <strong>windows.yml</strong> which reads :</p>
  
  <pre><code>ansible_user: Administrator
  ansible_password: SecretPasswordGoesHere
  ansible_port: 5986
  ansible_connection: winrm
  ansible_winrm_server_cert_validation: ignore 
  </code></pre>
  
  <p>Please let me know where I am going wrong.</p>