Hi,
I need help with setting up the connection between Ansible control host and 
a Windows Host. I've been looking around for issues relating to this one, 
but none seems to solve my issue.

I've redacted some sensitive info here.  

Here's the setup of Ansible control host,
*OS:* Ubuntu 16.04
*Ansible:* 2.9.13

*inventory*
win_host ansible_host=192.168.xxx.xxx

*host_vars/win_host.yml*
ansible_user: my.username
ansible_password: my_Password
ansible_port: 5986
ansible_winrm_tansport: ntlm
ansible_connection: winrm
ansible_winrm_message_encryption: auto
ansible_winrm_server_cert_validation: ignore
ansible_become_method: runas
ansible_shell_type: powershell
proxy_env:
  http_proxy: http://proxy:3128
  https_proxy: http://proxy:3128

*playbook.yml*
---

- name: Connect to my PC
  hosts: win_host
  tasks:
  - shell: echo Hello

*ansible.cfg*
[defaults]
inventory=./inventory/inventory
host_key_checking=false
local_tmp=$HOME/.ansible/tmp
remote_tmp=$HOME/.ansible/tmp
executable=cmd


error received when executing the playbook:
fatal: [win_host]: UNREACHABLE! => {
    "changed": false,
    "msg": "ssl: HTTPSConnectionPool(host='192.168.xxx.xxx', port=5986): 
Max retries exceeded with url: /wsman (Caused by ProxyError('Cannot connect 
to proxy.', error('Tunnel connection failed: 403 Forbidden',)))",
    "unreachable": true
}

Port 5986 seems to be accessible from the Ansible control host,
# nc -zv -w 5 192.168.xxx.xxx 5986
Connection to 192.168.xxx.xxx 5986 port [tcp/*] succeeded!

Here's the winrm output from my Windows host
winrm enumerate winrm/config/Listener
Listener
    Address = *
    Transport = HTTP
    Port = 5985
    Hostname
    Enabled = true
    URLPrefix = wsman
    CertificateThumbprint
    ListeningOn = 127.0.0.1, ::1

Listener
    Address = *
    Transport = HTTPS
    Port = 5986
    Hostname = HOSTNAME
    Enabled = true
    URLPrefix = wsman
    CertificateThumbprint = 8A570217AF03BF3BCD0ACFAE3090AB069EE148FC
    ListeningOn = 127.0.0.1, ::1

winrm get winrm/config/service
Service
    RootSDDL = 
O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
    MaxConcurrentOperations = 4294967295
    MaxConcurrentOperationsPerUser = 1500
    EnumerationTimeoutms = 240000
    MaxConnections = 300
    MaxPacketRetrievalTimeSeconds = 120
    AllowUnencrypted = false
    Auth
        Basic = true
        Kerberos = true
        Negotiate = true
        Certificate = false
        CredSSP = false
        CbtHardeningLevel = Relaxed
    DefaultPorts
        HTTP = 5985
        HTTPS = 5986
    IPv4Filter = *
    IPv6Filter = *
    EnableCompatibilityHttpListener = false
    EnableCompatibilityHttpsListener = false
    CertificateThumbprint
    AllowRemoteAccess = true

I'm not sure where I'm missing. I can run ping from the Ansible control 
host to my  Windows host but running ping over ansible is not possible.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/bfc370b5-2262-40ce-b8e5-15b5543f3e3cn%40googlegroups.com.

Reply via email to