Ansible get_url 超时
Ansible get_url is timing out
我在使用 Ansible 的 CentOs7 实例上从 Artifactory 下载 jar 文件时遇到问题。这是我第一次在 Linux 实例上这样做。
我在每个 Windows 实例上使用 win_get_url 模块,它工作正常
- name: download artifacts
win_get_url:
url: '{{ some_url }}'
username: '{{ jfrog_username }}'
password: '{{ jfrog_password }}'
dest: '{{ some_dest }}'
force: no
proxy_url: {{ some_proxy }}
当我使用 get_url 模块时,它超时了。我注意到 Linux 模块不支持参数 "proxy_url"。所以我尝试 运行 带有其他一些参数的任务,例如
- 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 }}
但它总是给我这个错误:
"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": {
我已经检查了防火墙设置并且 https 已打开 from/into 此服务器。
如有任何帮助,我们将不胜感激。
更新:
如果我使用 curl,根据 Zeitounator 提到的提示,它可以工作!我可以通过以下方式下载文件:
curl -O -u --user user:password 'https://some_url/installer.jar'
我没有使用代理密码。当 curl 询问 voor 代理密码时,我只是按下回车键并 curl 下载文件没有任何问题。
但是使用 Ansible 仍然没有运气。
根据我们的意见:您需要在任务或游戏级别的 environment
节中声明您正在使用的代理。
environment:
http_proxy: http://my_proxy:8080
https_proxy: http://my_proxy:8080
no_proxy: 127.0.0.1,localhost,.my_local_domain.com
如果您的代理需要身份验证,您必须在 uri 中传递身份验证:
http://user:password@my_proxy:8080
如果配置了代理@Zeitounator 回答正确。
但仍然可以尝试在下面添加:
- 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
get_url 模块的默认超时为 10 秒
我在使用 Ansible 的 CentOs7 实例上从 Artifactory 下载 jar 文件时遇到问题。这是我第一次在 Linux 实例上这样做。
我在每个 Windows 实例上使用 win_get_url 模块,它工作正常
- name: download artifacts
win_get_url:
url: '{{ some_url }}'
username: '{{ jfrog_username }}'
password: '{{ jfrog_password }}'
dest: '{{ some_dest }}'
force: no
proxy_url: {{ some_proxy }}
当我使用 get_url 模块时,它超时了。我注意到 Linux 模块不支持参数 "proxy_url"。所以我尝试 运行 带有其他一些参数的任务,例如
- 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 }}
但它总是给我这个错误:
"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": {
我已经检查了防火墙设置并且 https 已打开 from/into 此服务器。
如有任何帮助,我们将不胜感激。
更新:
如果我使用 curl,根据 Zeitounator 提到的提示,它可以工作!我可以通过以下方式下载文件:
curl -O -u --user user:password 'https://some_url/installer.jar'
我没有使用代理密码。当 curl 询问 voor 代理密码时,我只是按下回车键并 curl 下载文件没有任何问题。
但是使用 Ansible 仍然没有运气。
根据我们的意见:您需要在任务或游戏级别的 environment
节中声明您正在使用的代理。
environment:
http_proxy: http://my_proxy:8080
https_proxy: http://my_proxy:8080
no_proxy: 127.0.0.1,localhost,.my_local_domain.com
如果您的代理需要身份验证,您必须在 uri 中传递身份验证:
http://user:password@my_proxy:8080
如果配置了代理@Zeitounator 回答正确。
但仍然可以尝试在下面添加:
- 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
get_url 模块的默认超时为 10 秒