0

I have a strange problem. For some reason, ansible-galaxy command is not using my defined http proxy.

I am getting the following error:

sudo ansible-galaxy collection install community.docker
[sudo] password for <user>:
 [WARNING]: - collection was NOT installed successfully: Failed to get data from the API server (https://galaxy.ansible.com/api/): Failed to connect to galaxy.ansible.com at port 443: [Errno 110]
Connection timed out

ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.

I defined multiple variables to make sure proxy is triggered. http_proxy https_proxy HTTP_PROXY HTTPS_PROXY

Through wireshark analysis I can see that command ansible-galaxy collection install community.docker is trying to reach galaxy.ansible.com directly (resolving to: 104.206.0.234). It should go via proxy.

I also analyzed curl google.com and I can confirm that this traffic is going through http proxy, so the proxy is 100% working correctly.

**ansible version**
ansible 2.5.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/<user>/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Jul  1 2022, 15:56:32) [GCC 7.5.0]

DB_Tz
  • 1
  • 1

1 Answers1

0

If what you have is either an http or an https proxy - it won't work with socks5/socks5h proxies as far as I know - you just have to set environment variables, like this:

System-wide env vars

export http_proxy="http://<proxy_hostname>:<port>/"
export https_proxy="https://<proxy_hostname>:<port>/"

Curl specific env vars

export HTTP_PROXY="http://<proxy_hostname>:<port>/"
export HTTPS_PROXY="https://<proxy_hostname>:<port>/"

Cheers,

Beri

Jordi
  • 1
  • 1