gpt4 book ai didi

ssl - 如何修复以下 ansible Galaxy SSL 错误?

转载 作者:行者123 更新时间:2023-12-04 14:39:40 32 4
gpt4 key购买 nike

开始学习 Ansible 并希望帮助 ansible-galaxy search nginx命令,但我得到:

ERROR! Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/api': <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)> 
曾尝试使用 ansible-galaxy --ignore-certs search nginxansible-galaxy -c search nginx但现在得到 ansible-galaxy: error: unrecognized arguments: --ignore-certs展位。
操作系统:

Distributor ID: UbuntuDescription: Ubuntu 18.04.5 LTSRelease: 18.04Codename: bionic


Ansible 版本:
ansible 2.9.5
config file = /home/maciej/projects/priv/ansible_nauka/packt_course/ansible.cfg
configured module search path = ['/home/maciej/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/maciej/.local/lib/python3.6/site-packages/ansible
executable location = /home/maciej/.local/bin/ansible
python version = 3.6.9 (default, Jul 17 2020, 12:50:27) [GCC 8.4.0]

最佳答案

我有同样的问题,但在 Mac OS X 上。
根本问题是您的 Python 环境没有找到/使用安装在您的操作系统上的默认根证书。这些根证书是安全连接(通过 TLS)与 Ansible Galaxy 所必需的。
对于 Mac OS X 我能够根据这个答案解决这个问题:
How to make Python use CA certificates from Mac OS TrustStore?
即通过运行脚本来安装安装随附的证书:

cd /Applications/Python\ 3.7/
./Install\ Certificates.command
对于 Ubuntu/Debian :
更新:正如 Maciej 在接受的答案中指出的那样,可以重新生成证书并将其添加到环境中:
sudo update-ca-certificates --fresh
export SSL_CERT_DIR=/etc/ssl/certs
附言 : 我不建议使用 --ignore-certs ,这将跳过 TLS 连接中的证书验证,使连接不安全(允许 Man-in-the-middle attacks )

关于ssl - 如何修复以下 ansible Galaxy SSL 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63534262/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com