首页 > 解决方案 > Ansible copr 模块违规行

问题描述

我正在尝试对我整理的一个小测试脚本进行试运行,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,我得到以下输出:

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

我已按照此处的所有说明进行操作。谢谢您的帮助。

编辑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除了安装它,我没有做任何其他事情。也许问题在那里?

标签: linuxansibleyaml

解决方案


Using the command ansible-galaxy collection install community.general did not work for me, as it did not allow me to use the various modules.

What worked for me was to install the ansible-collection-community-general from the official repos.


推荐阅读