ansible报错AttributeError: module 'urllib.request' has no attribute 'HTTPSHandler'

2023-03-05,,

报错内容:

TASK [activemq : extract activemq tarball] ******************************************************************
fatal: [172.16.1.10]: FAILED! => {"changed": false, "module_stderr": "Shared connection to 172.16.1.10 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_3apyrzdd/ansible_module_unarchive.py\", line 136, in <module>\r\n    from ansible.module_utils.urls import fetch_url\r\n  File \"<frozen importlib._bootstrap>\", line 961, in _find_and_load\r\n  File \"<frozen importlib._bootstrap>\", line 950, in _find_and_load_unlocked\r\n  File \"<frozen importlib._bootstrap>\", line 646, in _load_unlocked\r\n  File \"<frozen importlib._bootstrap>\", line 616, in _load_backward_compatible\r\n  File \"/tmp/ansible_3apyrzdd/ansible_modlib.zip/ansible/module_utils/urls.py\", line 340, in <module>\r\nAttributeError: module 'urllib.request' has no attribute 'HTTPSHandler'\r\n", "msg": "MODULE FAILURE", "rc": 0}

解决办法:

yum install openssl-devel -y

重新编译python make&&make install

注:安装升级python时该装的依赖一个都不要少,常见 gcc glibc zlib-devel openssl-devel

ansible报错AttributeError: module 'urllib.request' has no attribute 'HTTPSHandler'的相关教程结束。

《ansible报错AttributeError: module 'urllib.request' has no attribute 'HTTPSHandler'.doc》

下载本文的Word格式文档,以方便收藏与打印。