2.4. 配置社区远程存储库并同步 Ansible Galaxy 集合。
您可以编辑 community 远程仓库,将所选的集合从 Ansible Galaxy 同步到本地 Automation Hub。默认情况下,您的本地自动化中心 community 仓库定向到 https://galaxy.ansible.com/api/。
先决条件
- 您有修改 Ansible 存储库内容的权限。如需了解更多有关权限的信息,请参阅 Automation Hub 中的管理用户访问权限。
-
您有一个
requirements.yml文件,用于标识要从 Ansible Galaxy 同步的集合。请参见以下示例。
Requirements.yml 示例
collections:
# Install a collection from Ansible Galaxy.
- name: geerlingguy.php_roles
version: 0.9.3
source: https://galaxy.ansible.com
collections:
# Install a collection from Ansible Galaxy.
- name: geerlingguy.php_roles
version: 0.9.3
source: https://galaxy.ansible.com
流程
- 登录到您的本地自动化中心。
- 进入 。
- 点 Remotes 选项卡。
-
在 Community 远程中,点 图标
并点 。
-
在相应的界面中,点 并在本地机器上找到
requirements.yml文件。 - 点击 。
界面关闭并返回到 Repo Management 页面。现在,您可以将 requirements.yml 文件中标识的集合从 Ansible Galaxy 同步到本地自动化中心。
- 点 以同步来自 Ansible Galaxy 和 Automation Hub 的集合。
Sync status 通知将会更新,以告知您 Automation Hub 与 Ansible Galaxy 集合的同步是否已完成或失败。
验证
您可以从集合内容下拉列表中选择 Community 来确认同步成功。