ansible galaxy collection安装超时



我在安装ansible集合时遇到问题,该集合以超时结束

# ansible-galaxy collection install community.general -vvvv
ansible-galaxy 2.9.9
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
executable location = /usr/local/bin/ansible-galaxy
python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
Using /etc/ansible/ansible.cfg as config file
Process install dependency map
Initial connection to galaxy_server: https://galaxy.ansible.com
Created /root/.ansible/galaxy_token
Calling Galaxy at https://galaxy.ansible.com/api/
Processing requirement collection 'community.general'
Collection requirement 'community.general' is the name of a collection
Found API version 'v1, v2' with Galaxy server default (https://galaxy.ansible.com/api/)
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/community/general/versions/
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/community/general/versions/1.2.0/
Collection 'community.general' obtained from server default https://galaxy.ansible.com/api/
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/google/cloud/versions/
Processing requirement collection 'google.cloud' - as dependency of community.general
Collection requirement 'google.cloud' is the name of a collection
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/google/cloud/versions/?page=2
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/ansible/posix/versions/
Collection 'google.cloud' obtained from server default https://galaxy.ansible.com/api/
Processing requirement collection 'ansible.posix' - as dependency of community.general
Collection requirement 'ansible.posix' is the name of a collection
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/ansible/posix/versions/?page=2
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/ansible/posix/versions/?page=3
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/ansible/posix/versions/?page=4
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/ansible/posix/versions/?page=5
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/ansible/netcommon/versions/
Collection 'ansible.posix' obtained from server default https://galaxy.ansible.com/api/
Processing requirement collection 'ansible.netcommon' - as dependency of community.general
Collection requirement 'ansible.netcommon' is the name of a collection
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/ansible/netcommon/versions/?page=2
ERROR! Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/v2/collections/ansible/netcommon/versions/?page=2': The read operation timed out
$ time curl https://galaxy.ansible.com/api/
{"description":"GALAXY REST API","current_version":"v1","available_versions":{"v1":"v1/","v2":"v2/"},"server_version":"3.4.7","version_name":"Doin' it Right","team_members":["chouseknecht","cutwater","alikins","newswangerd","awcrosby","tima","gregdek"]}
real    0m0.502s
user    0m0.028s
sys     0m0.015s

问题很明显:

# time curl https://galaxy.ansible.com/api/v2/collections/ansible/netcommon/versions/?page=2
<---- PAYLOAD ---->
real    0m0.979s
user    0m0.037s
sys     0m0.018s
# time curl https://galaxy.ansible.com/api/v2/collections/ansible/netcommon/versions/?page=2
<---- PAYLOAD ---->
real    0m16.729s
user    0m0.029s
sys     0m0.014s
# ping galaxy.ansible.com
PING galaxy.ansible.com (104.26.0.250) 56(84) bytes of data.
.....
44 packets transmitted, 44 received, 0% packet loss, time 104ms
rtt min/avg/max/mdev = 2.815/5.372/30.278/5.817 ms
# ping 8.8.8.8
.....
24 packets transmitted, 24 received, 0% packet loss, time 59ms
rtt min/avg/max/mdev = 2.866/4.895/25.451/4.608 ms

所以我决定从tarball安装集合,结果遇到了同样的问题,但这次下载依赖项超时

# ansible-galaxy collection install community-general-1.2.0.tar.gz -p /home/ansible/.ansible/collections -vvvv
.....
Process install dependency map
.....
Starting collection install process
Installing 'community.general:1.2.0' to '/home/ansible/.ansible/collections/ansible_collections/community/general'
Installing 'ansible.netcommon:1.3.0' to '/home/ansible/.ansible/collections/ansible_collections/ansible/netcommon'
Downloading https://galaxy.ansible.com/download/ansible-netcommon-1.3.0.tar.gz to /home/ansible/.ansible/tmp/ansible-local-1151707428cblg0/tmpbph_yq9r
ERROR! Unexpected Exception, this is probably a bug: The read operation timed out

操作系统是Centos8,Ansible配置文件是安装包中的原始文件。。。

$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="8 (Core)"
PLATFORM_ID="platform:el8"
$ ansible --version
ansible 2.9.9
config file = /home/ansible/ansible.cfg
configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]

知道如何克服这个问题吗?

谢谢!

也许您的网络提供商阻止了该网站https://galaxy.ansible.com/,尝试使用代理服务器,例如

export http_proxy=http://proxy_server_ip:port;
export https_proxy=http://proxy_server_ip:port;

相关内容

  • 没有找到相关文章

最新更新