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"
]
}

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM