windowsansiblekerberosntlm

Unable to connect to remote windows server: Ansible


Trying to run basic Ansible Windows module on a remote Windows server and receiving the error displayed below:

"unreachable": true,
"msg": "ntlm: HTTPConnectionPool(host='win_servername', port=5985): Max retries exceeded with url: /wsman (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7fec908b8da0>,
'Connection to win_servername timed out. (connect timeout=70)'))",
"changed": false

I tried checking the WinRM listeners, and they are enabled for ports 5985 and 5986. I am connecting to a TFS repository through SSH using a PAT token. The public key is placed in repo and the private key is stored in credentials.

TFS repo connecting with ansible tower

This is the code is to create file on remote windows server:

---
- hosts: [win server]

  tasks:
    - name: creating txt file on remote server
      win_copy:
       dest: C:\user\Desktop\check.txt
       remote_src: yes

The variables defined for remote servers are:

ansible_become_method: 'runas'
ansible_connection: 'winrm'
ansible_port: '5985'
ansible_winrm_server_cert_validation: ignore
ansible_winrm_transport: ntlm
ansible_user: Adminstrator

I'm using ansible_winrm_transport: kerberos

The error is as follows:

"msg": "kerberos: the python kerberos library is not installed"

How can I fix this?


Solution

  • provisioned administration rights to the service account (credentials stored in AAP) authenticating to remote windows server and error was resolved