Thanks a lot Mike!!
Your suggestion works, 
the .bashrc shortcut didn't work, but then I changed session.trust_env = 
True to False in transport.py and ansible made the connection.


W dniu piątek, 18 sierpnia 2017 16:20:27 UTC+2 użytkownik Mike Klebolt 
napisał:
>
> Hi Aleksander,
>
> Try adding no_proxy=<server IP> to your ~/.bashrc and reload it.  If you 
> will be working with many windows servers in the future, a more permanent 
> solution that worked for me is the following...
>
> 1. Locate transport.py that comes with pywinrm
> 2. modify the following line session.trust_env to make it false.
> 125         # configure proxies from HTTP/HTTPS_PROXY envvars
> 126 #        session.trust_env = True
> 127         session.trust_env = False
>
> 3.  pywinrm will no longer check your local env for a proxy.
>
>
> On Friday, August 18, 2017 at 9:10:58 AM UTC-5, Aleksander Lipka wrote:
>>
>> How do I export them?
>> When I echo them, I can see:
>>
>> root@localhost@localdomain: ansible# echo $http_proxy
>> http://161.90.234.10:8080
>>
>> root@localhost@localdomain: ansible# echo $https_proxy
>> https://161.90.234.10:8080
>>
>>
>> W dniu piątek, 18 sierpnia 2017 15:29:19 UTC+2 użytkownik J Hawkesworth 
>> napisał:
>>>
>>> Please can you try exporting
>>> HTTP_PROXY
>>> or 
>>> HTTPS_PROXY 
>>>
>>> environment variables before running ansible?
>>>
>>> I *think* this will let ansible (actually requests via pywinrm) know 
>>> that you are using a proxy.
>>>
>>> Hope this helps,
>>>
>>> Jon
>>>
>>> On Friday, August 18, 2017 at 8:37:28 AM UTC+1, Aleksander Lipka wrote:
>>>>
>>>> I know port shouldn't be y, I just assumed in the example that it's y.
>>>> Anyway I added ansible_winrm_server_cert_validation: ignore and 
>>>> ansible_winrm_transport: ntlm and still didn't work.
>>>> However I tried the second port you mentioned: 5985 (I use 5986 as 
>>>> default) and the playbook stopped at gathering facts for longer than usual 
>>>> and returned a different error:
>>>>
>>>> fatal: [WindowsServer]: UNREACHABLE! => 
>>>> {"changed": false, "msg": "ntlm: HTTPConnectionPool(host='161.90.234.10', 
>>>> port=8080): 
>>>> Read timed out. (read timeout=30)", "unreachable": true}
>>>>
>>>>
>>>> The IP and the port that you see in the error is actually the proxy 
>>>> that is set in IE in my WindowsServer2012 R2.
>>>> Still the connection was rejected, why?
>>>>
>>>> W dniu czwartek, 17 sierpnia 2017 19:01:21 UTC+2 użytkownik Mike 
>>>> Fennemore napisał:
>>>>>
>>>>> A few extra group_vars:
>>>>> ansible_winrm_server_cert_validation: false and ansible_port should be 
>>>>> a port number not y. It should be 5985 or 5986. You could also use ntlm 
>>>>> by 
>>>>> adding ansible_winrm_transport:ntlm
>>>>
>>>>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/979c7165-be86-4ee4-8e8b-7012424ad8b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to