No package matching 'nginx' found available, installed or updated
问题:ansible yum模块安装nginx,提示:No package matching 'nginx' found available, installed or updated [root@ansible ~]# ansible proxy -v -m yum -a "name=nginx state=present" Using /etc/ansible/ansible.cfg as config file 192.168.37.141 | FAILED! => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": false, "msg": "No package matching 'nginx' found available, installed or updated", "rc": 126, "results": [ "No package matching 'nginx' found available, installed or updated" ] } 解决方案: 在被管远程主机添加nginx仓库 , 参考url: http://nginx.org/en/linux_packages.html#RHEL-CentOS
vim /etc/yum.repos.d/nginx.repo
[nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true [nginx-mainline] name=nginx mainline repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true
[root@ansible ~]# ansible proxy -v -m yum -a "name=nginx state=present"
Using /etc/ansible/ansible.cfg as config file
192.168.37.141 | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": true,
"changes": {
"installed": [
"nginx"
]
},
"msg": "Repository base is listed more than once in the configuration\nRepository updates is listed more than once in the configuration\nRepository extras is listed more than once in the configuration\nRepository centosplus is listed more than once in the configuration\nwarning: /var/cache/yum/x86_64/7/nginx-stable/packages/nginx-1.20.2-1.el7.ngx.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY\nImporting GPG key 0x7BD9BF62:\n Userid : \"nginx signing key <signing-key@nginx.com>\"\n Fingerprint: 573b fd6b 3d8f bc64 1079 a6ab abf5 bd82 7bd9 bf62\n From : https://nginx.org/keys/nginx_signing.key\n",
"rc": 0,
"results": [
"Loaded plugins: fastestmirror\nLoading mirror speeds from cached hostfile\n * base: mirrors.aliyun.com\n * extras: mirrors.aliyun.com\n * updates: mirrors.dgut.edu.cn\nResolving Dependencies\n--> Running transaction check\n---> Package nginx.x86_64 1:1.20.2-1.el7.ngx will be installed\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package Arch Version Repository Size\n================================================================================\nInstalling:\n nginx x86_64 1:1.20.2-1.el7.ngx nginx-stable 790 k\n\nTransaction Summary\n================================================================================\nInstall 1 Package\n\nTotal download size: 790 k\nInstalled size: 2.8 M\nDownloading packages:\nPublic key for nginx-1.20.2-1.el7.ngx.x86_64.rpm is not installed\nRetrieving key from https://nginx.org/keys/nginx_signing.key\nRunning transaction check\nRunning transaction test\nTransaction test succeeded\nRunning transaction\n Installing : 1:nginx-1.20.2-1.el7.ngx.x86_64 1/1 \n----------------------------------------------------------------------\n\nThanks for using nginx!\n\nPlease find the official documentation for nginx here:\n* https://nginx.org/en/docs/\n\nPlease subscribe to nginx-announce mailing list to get\nthe most important news about nginx:\n* https://nginx.org/en/support.html\n\nCommercial subscriptions for nginx are available on:\n* https://nginx.com/products/\n\n----------------------------------------------------------------------\n Verifying : 1:nginx-1.20.2-1.el7.ngx.x86_64 1/1 \n\nInstalled:\n nginx.x86_64 1:1.20.2-1.el7.ngx \n\nComplete!\n"
]
}
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步