2.4. 配置社区远程存储库并同步 Ansible Galaxy 集合。

您可以编辑 community 远程存储库,将所选集合从 Ansible Galaxy 同步到私有自动化中心。默认情况下,您的私有自动化中心 community 存储库定向到 galaxy.ansible.com/api/

先决条件

  • 您有修改 Ansible 存储库内容的权限。如需了解更多有关权限的信息,请参阅 Automation Hub 中的管理用户访问权限
  • 您有一个 requirements.yml 文件,用于标识要从 Ansible Galaxy 同步的集合,如下例所示:

Requirements.yml 示例

collections:
  # Install a collection from Ansible Galaxy.
  - name: community.aws
    version: 5.2.0
    source: https://galaxy.ansible.com

流程

  1. 登录您的 Ansible Automation hub。
  2. 进入 Automation HubRemotes
  3. Community remote 中,点 More Actions 图标 HBAC 并选择 Edit
  4. 在相应的界面中,点 Browse 并在本地机器上找到 requirements.yml 文件。
  5. 点击 Save

    界面关闭并返回到 Remotes 页面。现在,您可以将 requirements.yml 文件中标识的集合从 Ansible Galaxy 同步到私有自动化中心。

  6. More Actions 图标 HBAC,然后选择 Sync 以同步来自 Ansible Galaxy 和 Ansible Automation Hub 的集合。

Sync status 通知会更新,以告知您与 Ansible Automation Hub 同步 Ansible Galaxy 集合的完成或失败。

验证

  • 从集合内容下拉列表中选择 Community 以确认同步成功。