【问题标题】:Ansible copr module offending lineAnsible copr 模块违规行
【发布时间】:2023-04-03 12:06:01
【问题描述】:

我正在尝试对我为ansible 编写的一个小型测试脚本进行试运行,但我遇到了一个错误。

脚本是这样的:

---
- hosts: localhost
  connection: local
  tasks:
    - name: Enable peterwu/iosevka
      community.general.copr:
        state: enabled
        name: peterwu/iosevka
    - name: Enable taw/element
      community.general.copr:
        host: copr.fedoraincloud.org
        state: enabled
        name: taw/element

但是,当我运行命令 ansible-playbook ~/Documents/Ansible/enable_repos.yml --check 时,我得到 this 输出:

ERROR! couldn't resolve module/action 'community.general.copr'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/[REDACTED]/Documents/Ansible/enable_repos.yml': line 5, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
    - name: Enable peterwu/iosevka
      ^ here

我已遵循here 的所有指示。感谢您的帮助。

编辑ansibleansible-galaxy 都是版本2.9.21;两者都是从官方的 Fedora 存储库安装的。我使用ansible-galaxy collection install community.general 并重新运行后一个命令会产生以下输出:

Process install dependency map
Starting collection install process
Skipping 'community.general' as it is already installed

除了安装它之外,我没有对ansible-galaxy 做任何其他事情。也许问题出在那儿?

【问题讨论】:

  • 您忘记包含您的 ansible 版本信息,但我的实际问题是:运行 ansible-galaxy collection list 的输出是什么,重点是 | grep copr
  • ansible 2.9.21 和命令 ansible-galaxy collection list 不起作用;它只给了我四个选择:1)initbuildpublishinstall...
  • 我在本地使用 2.9.21 进行了尝试,但无法重现您的体验,所以我猜您已经以某个用户的身份安装了该集合,而不是您用来运行 ansible-playbook 的用户;因为你的 ansible-galaxy 太旧了,你可以使用ansible-doc community.general.copr 来代替我试图弄清楚的东西:你的 ansible 安装是否看到集合。另外,虽然可能相关:他们的“从 github url 安装”被破坏了,所以我希望那不是你使用的那个
  • 我在我的问题中添加了一个edit。请看一看。我的版本是旧的吗?我以为2.10 还没出来?
  • v2.11, v2.10, and v2.9.22 are all released,尽管令人困惑的是他们的品牌重塑意味着"ansible v3" and "ansible v4" 也退出了:sob:

标签: linux ansible yaml


【解决方案1】:

使用命令ansible-galaxy collection install community.general 对我不起作用,因为它不允许我使用各种模块。

对我有用的是从官方仓库安装ansible-collection-community-general

【讨论】:

    猜你喜欢
    • 2017-07-27
    • 1970-01-01
    • 1970-01-01
    • 2018-07-17
    • 1970-01-01
    • 2015-09-28
    • 1970-01-01
    • 2019-01-20
    • 1970-01-01
    相关资源
    最近更新 更多