0

在构建打包程序映像时,在使用 ansible 安装 epel 期间:

- name: install EPEL yum repository
  yum:
    name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    state: present

我收到此错误:

fatal: [default]: FAILED! => {"changed": false, "msg": "warning: /home/centos/~user/.ansible/tmp/ansible-tmp-1602677619.35-135127023136118/epel-release-latest-7.noarch4i6J_H.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY\n\n\nPublic key for epel-release-latest-7.noarch4i6J_H.rpm is not installed\n", "rc": 1, "results": ["Loaded plugins: fastestmirror\nExamining /home/centos/~user/.ansible/tmp/ansible-tmp-1602677619.35-135127023136118/epel-release-latest-7.noarch4i6J_H.rpm: epel-release-7-12.noarch\nMarking /home/centos/~user/.ansible/tmp/ansible-tmp-1602677619.35-135127023136118/epel-release-latest-7.noarch4i6J_H.rpm to be installed\nResolving Dependencies\n--> Running transaction check\n---> Package epel-release.noarch 0:7-12 will be installed\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package         Arch      Version Repository                              Size\n================================================================================\nInstalling:\n epel-release    noarch    7-12    /epel-release-latest-7.noarch4i6J_H     24 k\n\nTransaction Summary\n================================================================================\nInstall  1 Package\n\nTotal size: 24 k\nInstalled size: 24 k\nDownloading packages:\n"]}
         to retry, use: --limit @/home/ansible/install.retry

 PLAY RECAP *********************************************************************
 default                    : ok=3    changed=2    unreachable=0    failed=1

有人遇到过类似的问题吗?

4

1 回答 1

0

您的系统上缺少 epel GPG 密钥,您应该添加

disable_gpg_check: yes到您的任务以完全跳过 gpg 检查(不安全,不好的做法),或在rpm_key模块中添加实际的 gpg 密钥,即在运行任务之前

- name: Import a key from a url
  rpm_key:
    state: present
    key: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7

您可以在 epel root 中找到适当的密钥。

但是,如果你有一个 centos 7 系统,添加 epel 最简单的方法是安装 epel-release 包,而无需实际从 fedora 项目中提取 rpm,即

- name: install EPEL yum repository
  yum:
    name: epel-release
    state: present
于 2020-10-21T12:56:23.730 回答