ansible git 克隆超时

ansible git clone times out

在服务器上,我可以 运行 成功执行以下操作:

ssh-agent bash -c 'ssh-add /path/key; git clone https://repo_path/repo_name.git'

repo 被克隆到 'repo_name'

然而,当我 运行 在本地机器上执行以下 ansible (2.2) 脚本时,克隆任务无限期停止

- name: clone or pull latest web app code
  git: repo=https://repo_path/repo_name.git dest=/home/user/repo_name
     key_file=/path/key
     accept_hostkey=yes
     force=yes

克隆任务之前的其他任务正常(apt 更新、库安装等)

我正在使用以下方法检查路径是否正确,它们似乎没问题:

- debug:
    msg: "about to clone code {{ code_repository }} to {{ base_dir }}"

有什么想法吗?

注意:ssh-add /path/keygit clone https://repo_path/repo_name.git没有任何关系。
ssh-add /path/key 用于向 ssh-agent 添加密码保护的 SSH 私钥,以便在 SSH URL.
需要时缓存所述密码 https://repo_path/... 是 HTTPS URL,这意味着它不需要 SSH 密钥。完全没有。

ansible git module确实提到:

accept_hostkey

if yes, ensure that "-o StrictHostKeyChecking=no" is present as an ssh option.

同样,URL 是 HTTPS,因此不需要。

尝试删除 key-fileaccept_hostkey,看看 HTTPS 克隆是否可以继续。


对于 SSH URL,您需要确保: