You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

从GitHub安装Ansible Collection报错,请求排查操作问题

问题原因与解决方法

错误原因

你直接使用git+https://github.com/devroles/ansible_collection_system.git作为安装目标的格式不符合Ansible Galaxy的命令规范。ansible-galaxy collection install识别Git仓库地址时,需要遵循特定语法,不能直接把完整URL当作集合名称传入,这才触发了"无效集合名称"的报错。

正确的Git安装命令

从Git仓库安装Ansible集合,需使用以下格式的命令:

ansible-galaxy collection install git+<仓库URL>,<分支/标签/提交哈希>

比如安装仓库main分支的最新版本,命令应为:

vm:~/ansible/test$ ansible-galaxy collection install git+https://github.com/devroles/ansible_collection_system.git,main

另外,也可以先克隆仓库到本地再执行安装:

  1. 克隆仓库到本地目录:
git clone https://github.com/devroles/ansible_collection_system.git
  1. 进入仓库目录,执行本地安装:
cd ansible_collection_system
ansible-galaxy collection install .

补充说明

使用devroles.system能正常安装,是因为这个格式是Ansible Galaxy标准的集合命名规则(<命名空间>.<集合名>),命令会自动从官方源拉取对应集合;而直接用Git URL时,必须带上分支/标签/哈希这类版本标识,让命令识别这是一个Git仓库地址,而非非法的集合名称。

内容的提问来源于stack exchange,提问作者sundrys1

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 09:42:39