skip to Main Content

I have troubles downloading a jar file from Artifactory on a CentOs7 instance with Ansible. It is the first time i do that on a Linux instance.

I am using the win_get_url module on every Windows instance and it is working normaly

   - name: download artifacts
     win_get_url:
       url: '{{ some_url }}'
       username: '{{ jfrog_username }}'
       password: '{{ jfrog_password }}'
       dest: '{{ some_dest }}'
       force: no
       proxy_url: {{ some_proxy }}

When i use the get_url module it is timeing out. I have noticed that the Linux module doen’t support the parameter “proxy_url”. so i have tried to run the tasks with some other parameters like

   - name: download artifacts
     get_url:
       url: '{{ some_url }}'
       username: '{{ jfrog_username }}'
       password: '{{ jfrog_password }}'
       dest: '{{ some_dest }}'
       force: no
       use_proxy: yes
       http_agent"{{ proxy }}
       checksum: {{ checksum }}

But it gives me always this error:

  "status": -1,
  "url": "https://some_url/installer.jar",
  "msg": "Failed to connect to www.jfrog.io at port 443: [Errno 110] Connection timed out",
  "invocation": {

I have checked the Firewall setting and https is open from/into this server.

Any help would be appreciated.

UPDATE:

If i use curl, based on the tip mentioned by Zeitounator it works! i can download the file with:

     curl -O -u --user user:password 'https://some_url/installer.jar' 

I am not using proxy password. When curl asked voor proxy password i just pressed enter and curl downloaded the file without any issues.

But with Ansible still no luck.

2

Answers


  1. Following our comments: you need to declare the proxy your are using in an environment stanza, either at task or play level.

    environment:
      http_proxy: http://my_proxy:8080
      https_proxy: http://my_proxy:8080
      no_proxy: 127.0.0.1,localhost,.my_local_domain.com
    

    If your proxy needs authentification, you’ll have to pass the auth in the uri:

    http://user:password@my_proxy:8080
    
    Login or Signup to reply.
  2. if proxy is configured @Zeitounator answered it correctly.

    But still can try adding below:

    - name: download artifacts
     get_url:
       url: '{{ some_url }}'
       username: '{{ jfrog_username }}'
       password: '{{ jfrog_password }}'
       dest: '{{ some_dest }}'
       force: no
       use_proxy: yes
       http_agent"{{ proxy }}
       checksum: {{ checksum }}
       timeout: 30
    

    As default timeout for get_url module is 10 seconds

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search