Tre*_*van 8 ansible ansible-galaxy
的文档ansible-galaxy说明如下:
ansible-galaxy 命令与 Ansible 捆绑在一起,您可以使用它从 Galaxy 或直接从基于 git 的 SCM 安装角色。您还可以使用它在 Galaxy 网站上创建新角色、删除角色或执行任务。
我试图弄清楚如何“直接从基于 git 的 SCM ”安装 Ansible 集合,如所示。当我ansible-galaxy collections --help从 MacOS Catalina 上的 Ansible 2.9.1运行时,我看到以下内容:
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.
Run Code Online (Sandbox Code Playgroud)
我尝试为-p参数指定 GitHub 存储库 URI ,但没有识别有效的 URI,而是ansible-galaxy尝试查看名为我指定的 URI的子文件夹。
ansible-galaxy collection install -p https://github.com/pcgeek86/ansible-galaxy-test trevor.trevormacos
Run Code Online (Sandbox Code Playgroud)
我的期望是为-p参数指定一个 GitHub 存储库 URI应该正确地表明我想从该 GitHub 存储库安装一个集合。
问题:如何指示直接从 GitHub URIansible-galaxy安装 Ansible 集合?
从最近的 Ansible 版本 2.10 开始,这已经成为可能。
请参阅: https: //github.com/ansible/ansible/pull/69154
要使用它,您可以指定类似于角色:
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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1909 次 |
| 最近记录: |