首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >直接从带有ansible-galaxy的git URI安装Ansible集合。

直接从带有ansible-galaxy的git URI安装Ansible集合。
EN

Stack Overflow用户
提问于 2019-11-22 23:16:23
回答 1查看 6.1K关注 0票数 11

ansible-galaxy的文档说明如下:

ansible-galaxy命令与Ansible捆绑在一起,您可以使用它从银河安装角色,或者直接从基于git的单片机安装角色。您还可以使用它在银河网站上创建新角色、删除角色或执行任务。

我正试图弄清楚如何能够“直接从基于git的SCM”安装一个Ansible集合。当我从Ansible 2.9.1在ansible-galaxy collections --help Catalina上运行MacOS时,我会看到以下内容:

代码语言:javascript
复制
usage: ansible-galaxy collection install [-h] [-s API_SERVER]
                                         [--api-key API_KEY] [-c] [-v] [-f]
                                         [-i] [-n | --force-with-deps]
                                         [-p COLLECTIONS_PATH]
                                         [-r REQUIREMENTS]
                                         [collection_name [collection_name ...]]

positional arguments:
  collection_name       The collection(s) name or path/url to a tar.gz
                        collection artifact. This is mutually exclusive with
                        --requirements-file.

optional arguments:
  -h, --help            show this help message and exit
  -s API_SERVER, --server API_SERVER
                        The Galaxy API server URL
  --api-key API_KEY     The Ansible Galaxy API key which can be found at
                        https://galaxy.ansible.com/me/preferences. You can
                        also use ansible-galaxy login to retrieve this key or
                        set the token for the GALAXY_SERVER_LIST entry.
  -c, --ignore-certs    Ignore SSL certificate validation errors.
  -v, --verbose         verbose mode (-vvv for more, -vvvv to enable
                        connection debugging)
  -f, --force           Force overwriting an existing role or collection
  -i, --ignore-errors   Ignore errors during installation and continue with
                        the next specified collection. This will not ignore
                        dependency conflict errors.
  -n, --no-deps         Don't download collections listed as dependencies.
  --force-with-deps     Force overwriting an existing collection and its
                        dependencies.
  -p COLLECTIONS_PATH, --collections-path COLLECTIONS_PATH
                        The path to the directory containing your collections.
  -r REQUIREMENTS, --requirements-file REQUIREMENTS
                        A file containing a list of collections to be
                        installed.

我尝试为GitHub参数指定一个-p存储库URI,但是ansible-galaxy试图查找一个名为URI的子文件夹,而不是识别一个有效的URI。

代码语言:javascript
复制
ansible-galaxy collection install -p https://github.com/pcgeek86/ansible-galaxy-test trevor.trevormacos

我的期望是,为GitHub参数指定一个-p存储库URI应该正确地表明我希望从GitHub存储库中安装一个集合。

问题:如何指示ansible-galaxy直接从GitHub URI安装不可接受的集合

EN

回答 1

Stack Overflow用户

发布于 2020-07-27 15:02:14

由于最近的AnbleVersion2.10,这现在是可能的。

请参阅:https://github.com/ansible/ansible/pull/69154

要使用它,可以指定与角色类似的内容:

代码语言:javascript
复制
collections:
  - name: git@github.com:my_org/private_collections.git#/path/to/collection,devel
  - name: https://github.com/ansible-collections/amazon.aws.git
    type: git
    version: 8102847014fd6e7a3233df9ea998ef4677b99248
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59003007

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档