尝试添加 epel,然后通过 ansible 在 amazon-linux-2 服务器上进行 yum 更新。我使用的 URL 基于:https ://aws.amazon.com/premiumsupport/knowledge-center/ec2-enable-epel/
我的ansible脚本是:
---
- hosts: all
remote_user: cloud_user
tasks:
- name: 01 add epel
yum_repository:
name: epel
description: EPEL YUM repo
baseurl: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
become: yes
- name: 02 yum update
yum: name=* state=latest
become: yes
我的错误是在任务 02 上(任务 01 有一个“更改”通知):
FAILED! => {"changed": false, "msg": "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm/repodata/repomd.xml:
[Errno 14] HTTPS Error 404 - Not Found\nTrying other mirror.\n\n\n One of the configured repositories failed (EPEL YUM repo),\n and yum doesn't have enough cached data to continue. At this point the only\n safe thing yum can do is fail. There are a few ways to work \"fix\" this:\n\n
1. Contact the upstream for the repository and get them to fix the problem.\n\n
2. Reconfigure the baseurl/etc. for the repository, to point to a working\n upstream. This is most often useful if you are using a newer\n distribution release than is supported by the repository (and the\n packages for the previous distribution release still work).\n\n
3. Run the command with the repository temporarily disabled\n yum --disablerepo=epel ...\n\n
4. Disable the repository permanently, so yum won't use it by default. Yum\n
will then just ignore the repository until you permanently enable it\n again or use --enablerepo for temporary usage:\n\n
yum-config-manager --disable epel\n
or\n
subscription-manager repos --disable=epel\n\n
5. Configure the failing repository to be skipped, if it is unavailable.\n Note that yum will try to contact the repo. when it runs most commands,\n
so will have to try and fail each time (and thus. yum will be be much\n
slower). If it is a very temporary problem though, this is often a nice\n
compromise:\n\n yum-config-manager --save --setopt=epel.skip_if_unavailable=true\n\nfailure: repodata/repomd.xml from epel:
[Errno 256] No more mirrors to try.\nhttps://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm/repodata/repomd.xml:
[Errno 14] HTTPS Error 404 - Not Found\n", "rc": 1, "results": []}
任何指导或帮助都会很棒。