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

您可以编辑 community 远程存储库,将所选的集合从 Ansible Galaxy 同步到本地 Automation Hub。默认情况下,您的本地 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

流程

  1. 登录到您的本地 Automation Hub。
  2. 进入 Repo Management
  3. Remotes 选项卡。
  4. community 远程中,点 More actions 并点 Edit
  5. 在相应的界面中,点 Browse 并在本地机器上找到 requirements.yml 文件。
  6. Save

界面将关闭并返回到 Repo Management 页面。现在,您可以将在 requirements.yml 文件中指定的集合从 Ansible Galaxy 同步到本地 Automation Hub。

  1. Sync 以同步来自 Ansible Galaxy 和 Automation Hub 的集合。

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

验证

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