簡體   English   中英

在 Ansible Tower 中使用本地 git 存儲庫

[英]Using local git repository with Ansible Tower

我已經成功地將 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 嘗試更新時,正在使用awx用戶執行 git 命令(查看 ps 進程)。 awx用戶擁有 AnsibleTower.git 目錄和其中的所有內容。

這很重要的原因以及我標記這個“ansible-inventory”的原因是,使用 SCM 支持的項目似乎是將基於文本的庫存導入/同步到 Tower 的唯一方法。 我真的很想避免使用 Tower 網絡界面重新創建/更新我的庫存; 我也希望在 SCM 中進行跟蹤。

我什至允許所有用戶訪問 .git 目錄(臨時); 這也不起作用,它似乎不是用戶權限問題。

您可以省略原點開頭的 file://。 所有本地存儲庫都不需要這個,並且某些操作系統無法處理本地文件/目錄的 file:// uri

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM