【问题标题】:Using local git repository with Ansible Tower将本地 git 存储库与 Ansible Tower 一起使用
【发布时间】:2020-02-16 18:27:45
【问题描述】:

我已成功配置 Ansible Tower 项目以从远程 git 存储库中提取,并使用 ssh 和存储的凭据(密钥)从本地存储库中提取。在此服务器上,不允许 ssh 登录访问 git,因此我尝试将 Ansible Tower 配置为使用本地 git 存储库;不使用 git: 或 ssh: 协议访问,只需通过 file:///path/to/AnsibleTower.git 访问它

Ansible Tower 项目更新函数尝试“git clone”,但它给出了错误:

        "fatal: Could not read from remote repository.",
        "Please make sure you have the correct access rights",
        "and the repository exists."

它显示这是它用来尝试克隆的命令:

"cmd": "/usr/bin/git clone --origin origin file:///path/to/AnsibleTower.git/ /var/lib/awx/projects/_114__00_test"

当我直接在服务器上执行上述命令时,作为awx 用户,我没有收到任何错误,并且克隆工作正常。当 Tower 尝试更新时,我可以看到 git 命令正在使用 awx 用户执行(监视 ps 的进程)。 awx 用户拥有 AnsibleTower.git 目录及其中的所有内容。

这很重要以及我将其标记为“ansible-inventory”的原因是,使用 SCM 支持的项目似乎是将基于文本的清单导入/同步到 Tower 的唯一方法。我真的很想避免使用 Tower Web 界面重新创建/更新我的库存;我也希望在 SCM 中进行跟踪。

我什至授权所有用户访问 .git 目录(暂时);这也不起作用,这似乎不是用户权限问题。

【问题讨论】:

    标签: git ansible ansible-inventory ansible-tower


    【解决方案1】:

    您可以省略原点开头的 file://。 所有本地存储库都不需要这个,并且某些操作系统无法处理本地文件/目录的 file://uri

    【讨论】:

    • 我尝试删除 file:// 但没有任何变化。错误完全相同;没有更糟。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-06
    • 2015-10-02
    • 1970-01-01
    • 2011-09-16
    • 2014-09-06
    • 1970-01-01
    • 2023-04-06
    相关资源
    最近更新 更多