Ansible---关于yum奇葩问题记录
Posted cherylgi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ansible---关于yum奇葩问题记录相关的知识,希望对你有一定的参考价值。
注:ip全部用xxx.xxx.xxx.xxx代替
以下是我在ansible主机执行的结果,当我用yum模块的时候,报错如下:
(venv) [root@hmys os_script]# ansible xxx.xxx.xxx.xxx -u root -m yum -a "state=installed name=readline-devel" xxx.xxx.xxx.xxx | FAILED! => { "ansible_facts": { "pkg_mgr": "yum" }, "changed": false, "msg": "http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Name or service not known" Trying other mirror. http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyun.com:80; Connection timed out" Trying other mirror. http://mirrors.aliyuncs.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection timed out" Trying other mirror. http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyun.com:80; Connection timed out" Trying other mirror. http://mirrors.aliyuncs.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection timed out" Trying other mirror. http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyun.com:80; Connection timed out" Trying other mirror. http://mirrors.aliyuncs.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection timed out" Trying other mirror. http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyun.com:80; Connection timed out" Trying other mirror. http://mirrors.aliyuncs.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection timed out" Trying other mirror. Error downloading packages: readline-devel-6.2-11.el7.x86_64: [Errno 256] No more mirrors to try. ", "rc": 1, "results": [ "Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription- : manager This system is not registered with an entitlement server. You can use subscription-manager to register. Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: epel.mirror.angkasa.id * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package readline-devel.x86_64 0:6.2-11.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: readline-devel x86_64 6.2-11.el7 base 139 k Transaction Summary ================================================================================ Install 1 Package Total download size: 139 k Installed size: 259 k Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. " ] }
我尝试用shell模块执行,依然报错:
(venv) [root@hmys os_script]# ansible xxx.xxx.xxx.xxx -u root -m shell -a "yum install -y readline-devel" [WARNING]: Consider using the yum module rather than running yum. If you need to use command because yum is insufficient you can add warn=False to this command task or set command_warnings=False in ansible.cfg to get rid of this message. xxx.xxx.xxx.xxx | FAILED | rc=1 >> Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription- : manager This system is not registered with an entitlement server. You can use subscription-manager to register. Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: epel.mirror.angkasa.id * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package readline-devel.x86_64 0:6.2-11.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: readline-devel x86_64 6.2-11.el7 base 139 k Transaction Summary ================================================================================ Install 1 Package Total download size: 139 k Installed size: 259 k Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed.http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Name or service not known" Trying other mirror. http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyun.com:80; Connection timed out" Trying other mirror. http://mirrors.aliyuncs.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection timed out" Trying other mirror. http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyun.com:80; Connection timed out" Trying other mirror. http://mirrors.aliyuncs.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection timed out" Trying other mirror. http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyun.com:80; Connection timed out" Trying other mirror. http://mirrors.aliyuncs.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection timed out" Trying other mirror. http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyun.com:80; Connection timed out" Trying other mirror. http://mirrors.aliyuncs.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection timed out" Trying other mirror. Error downloading packages: readline-devel-6.2-11.el7.x86_64: [Errno 256] No more mirrors to try.non-zero return code
然鹅,当我到远程主机去手动执行的时候,竟然执行成功了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[root@1a01vla6815zzzz test_permission]# yum install -y readline-devel Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: epel.mirror.angkasa.id * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package readline-devel.x86_64 0:6.2-11.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved =========================================================================================================================================================================================================================================================================== Package Arch Version Repository Size =========================================================================================================================================================================================================================================================================== Installing: readline-devel x86_64 6.2-11.el7 base 139 k Transaction Summary =========================================================================================================================================================================================================================================================================== Install 1 Package Total download size: 139 k Installed size: 259 k Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. readline-devel-6.2-11.el7.x86_ FAILED http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/readline-devel-6.2-11.el7.x86_64.rpm: [Errno 14] HTTP Error 502 - Bad Gateway ] 0.0 B/s | 0 B --:--:-- ETA Trying other mirror. readline-devel-6.2-11.el7.x86_64.rpm | 139 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : readline-devel-6.2-11.el7.x86_64 1/1 Verifying : readline-devel-6.2-11.el7.x86_64 1/1 Installed: readline-devel.x86_64 0:6.2-11.el7 Complete!
解决方案:整理中.......
以上是关于Ansible---关于yum奇葩问题记录的主要内容,如果未能解决你的问题,请参考以下文章