【发布时间】: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 的所有指示。感谢您的帮助。
编辑:ansible 和ansible-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)init、build、publish和install... -
我在本地使用 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: