【问题标题】:Updating a Ansible role which has been installed with ansible-galaxy from a GitHub repo从 GitHub 存储库更新已使用 ansible-galaxy 安装的 Ansible 角色
【发布时间】:2021-03-10 02:10:09
【问题描述】:

每当我在存储库中更改我的 Ansible 角色中的代码时,我还希望在我的测试机器上的角色目录中更新该代码。 我获取新代码的方法是

  1. 通过运行ansible-galaxy remove rolename 删除角色
  2. 使用ansible-galaxy install git+https://url/rolename再次安装角色

如果我在 install 之前不使用 remove 选项,ansible-galaxy 会跳过已安装的角色。它不会在 repo 中看到更改的文件。

实现这一目标的最佳方法是什么?

【问题讨论】:

    标签: github roles ansible-galaxy


    【解决方案1】:

    看来更新角色的推荐路径是使用--force 选项。

    来自ansible-galaxy install --help

      -f, --force           Force overwriting an existing role or collection
    

    作为参考,还可以在他们的存储库中查看那些喜欢的内容:

    所以你的情况

    ansible-galaxy install --force git+https://url/rolename
    

    【讨论】:

      猜你喜欢
      • 2016-10-25
      • 1970-01-01
      • 2016-08-25
      • 2014-10-03
      • 1970-01-01
      • 2020-02-20
      • 1970-01-01
      • 1970-01-01
      • 2023-02-02
      相关资源
      最近更新 更多