【问题标题】:Unable to add EPEL repo using Ansible - RHEL 7无法使用 Ansible 添加 EPEL 存储库 - RHEL 7
【发布时间】:2016-11-14 10:49:33
【问题描述】:

我正在尝试使用剧本在Ansible 上安装 EPEL 存储库。

我的play如下:

- name: add epel repo   
  tags: addEpelRepo
          yum: name=https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm state=present
          register: epelRepoOut
          notify:
            - yum update
        - debug: var=epelRepoOut.stdout_lines

即使执行了这个播放,EPEL 也没有安装。运行yum repolist 不包含EPEL。
我的问题:
1. 如何启用 EPEL repo?
2.我也试过yum_repository模块在下面的戏里:

- name: Add repository
  yum_repository:
    name: epel
    description: EPEL YUM repo
    baseurl: http://download.fedoraproject.org/pub/epel/$releasever/$basearch/

虽然在/etc/yum.repos.d/ 中创建了一个 EPEL 存储库文件,但我无法从该文件中安装任何内容。我怎样才能做到这一点?

更新:输出是:

ok: [localhost] => {
    "changed": false,
    "invocation": {
        "module_args": {
            "conf_file": null,
            "disable_gpg_check": true,
            "disablerepo": null,
            "enablerepo": null,
            "exclude": null,
            "install_repoquery": true,
            "list": null,
            "name": [
                "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
            ],
            "state": "present",
            "update_cache": false,
            "validate_certs": true
        },
        "module_name": "yum"
    },
    "msg": "",
    "rc": 0,
    "results": []
}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0

【问题讨论】:

  • epelRepoOut 上是否有任何调试消息?
  • 你可以试试disable_gpg_check=yes选项。
  • @Kadir:感谢您的回复。我已经用输出更新了问题..
  • 从输出看来,epel-release rpm 已安装。可以发一下/etc/yum.repos.d/epel.repo文件的内容吗?
  • 该文件夹中没有 epel.repo 文件..

标签: ansible yum


【解决方案1】:

我已经通过两种方式完成了 IIRC。 (1) 我在我的存储库 (epel-release) 中安装了一个 rpm。 (2) 我自己模板了 yum.repos.d 文件。 如果您选择第二种方法,您可能必须禁用 gpg 检查或使用 rpm 命令导入密钥。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-20
    • 1970-01-01
    • 2014-09-30
    • 1970-01-01
    • 2016-06-25
    • 2020-01-26
    相关资源
    最近更新 更多