gpt4 book ai didi

ansible-galaxy - 指定要安装的版本范围

转载 作者:行者123 更新时间:2023-12-02 02:24:00 31 4
gpt4 key购买 nike

我正在尝试安装 Ansible Galaxy 集合,但我需要强制执行旧版本。 According to the documentation ,我尝试通过以下方式执行安装:

$ ansible-galaxy collection install 'weareinteractive.ufw:>=1.10.0,<2.0.0'
Process install dependency map
ERROR! Failed to find collection weareinteractive.ufw:>=1.10.0,<2.0.0
$ ansible-galaxy collection install 'weareinteractive.ufw:<2.0.0'
Process install dependency map
ERROR! Failed to find collection weareinteractive.ufw:<2.0.0

当尝试从此 requirements.yml 执行相同操作时,我在全局范围内遇到了相同类型的错误:

---
- name: weareinteractive.ufw
version: '>=1.8.0,<2.0.0'

运行命令

$ ansible-galaxy install -r requirements.yml
- downloading role 'ufw', owned by weareinteractive
[WARNING]: - weareinteractive.ufw was NOT installed successfully: - the specified version (>=1.8.0,<2.0.0) of weareinteractive.ufw was not found in the list of available versions ([{'id': 141713, 'url': '', 'related': {}, 'summary_fields': {}, 'created':
'2020-11-25T18:52:30.171540Z', 'modified': '2020-11-25T18:52:30.171568Z', 'name': '2.0.1', 'version': '2.0.1', 'commit_date': '2020-11-25T10:51:53-05:00', 'commit_sha': '30b1fdc8f5440e865d3fbeb83894941bf70739c7', 'download_url':
'https://github.com/weareinteractive/ansible-ufw/archive/2.0.1.tar.gz', 'active': None}, {'id': 76043, 'url': '', 'related': {}, 'summary_fields': {}, 'created': '2018-10-04T14:07:47.602784Z', 'modified': '2018-10-04T14:07:47.602810Z', 'name': '1.8.0', 'version':
'1.8.0', 'commit_date': '2018-10-04T10:05:07-04:00', 'commit_sha': 'ae776a7dc255ba5dc679cedee32129ba22c0e797', 'download_url': 'https://github.com/weareinteractive/ansible-ufw/archive/1.8.0.tar.gz', 'active': None}, .....]).
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.

我错过了什么?

编辑:我正在使用 ansible/ansible-galaxy 2.9.16,但我希望有一个解决方案仍然适用于 ansible 2.10

最佳答案

如您尝试安装的角色存储库首页所述:

Ansible weareinteractive.ufw role

来源:https://github.com/weareinteractive/ansible-ufw#ansible-weareinteractiveufw-role

它是一个角色而不是一个集合。

尽管这两种语法可能看起来很相似,但实际上它们的语法并不完全相同。
对于角色,首先,您不通过安装它们

ansible-galaxy collection install some-collection

显然,但是通过:

ansible-galaxy install some-role

注意:他们的 GitHub 页面和 Ansible Galaxy 页面都证实了这一点,建议您通过以下方式安装角色

ansible-galaxy install weareinteractive.ufw

来源:https://galaxy.ansible.com/weareinteractive/ufwhttps://github.com/weareinteractive/ansible-ufw


然后,版本固定也不同。在角色上,您必须指定版本,而不是版本范围:

When the Galaxy server imports a role, it imports any git tags matching the Semantic Version format as versions. In turn, you can download a specific version of a role by specifying one of the imported tags.

来源:https://docs.ansible.com/ansible/latest/galaxy/user_guide.html#installing-a-specific-version-of-a-role

所以你必须以他们的 repo 的 git 标签为基础,例如

ansible-galaxy install weareinteractive.ufw,v1.10.0

requirement.yml 也是 differs a bit ,您还必须在其中给出特定的版本。

- name: weareinteractive.ufw
version: v1.10.0

关于ansible-galaxy - 指定要安装的版本范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65968435/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com