network unreachable

Hi,
Searching proxy in this list, I found no answer, so maybe it’s not a proxy issue :

I run a playbook with following task :

`

  • name: download miniconda installer
    get_url:
    url={{ miniconda_url }}
    dest={{ miniconda_tmp }}/miniconda.sh
    mode=0755
    register: miniconda_downloaded
    when: bin_conda.stat.exists == False
    `

I get this error :

fatal: [ansible-target]: FAILED! => changed=false msg: 'Failed to connect to repo.anaconda.com at port 443: [Errno 101] Le réseau n''est pas accessible' status: -1 url: https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

Le réseau n’‘est pas accessible’ is french for network unreachable.
If I try, on both admin and target, with ansible user ID (sudo su - ansible) the command :
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

It works.

Why would ansible fail to download this as wget succeeds? Is there a proxy configuration I forgot?

I forgot ton mention that http_proxy and https_proxy are defined on both admin and target

I guess you have http_proxy/https_proxy set in the environment for the Ansible user?

When Ansible execute scripts on the remote host it's using non interactive shell and it's not reading all the environment files that a interactive shell does.
So the easiest solution would be to set the environment in Ansible
https://docs.ansible.com/ansible/latest/user_guide/playbooks_environment.html