【发布时间】:2014-06-17 20:18:40
【问题描述】:
我在使用 ssh 转发从 Git 克隆存储库时遇到问题。这是我的设置:
- name: Setup/pull the Git repo
git: repo={{ git_repo }} dest={{ git_root }} update=yes accept_hostkey=yes
when: setup_git_repo
tags: git deploy
#git_repo = git@github.com:my_name/repo.git
我从 -vvvv 得到这个调试
<x.x.x.x> ESTABLISH CONNECTION FOR USER: ubuntu
<x.x.x.x> REMOTE_MODULE git repo=git@github.com:name/repo.git dest=/webapps/example-app/example update=yes accept_hostkey=yes
<x.x.x.x> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ForwardAgent=yes', '-o', u'IdentityFile="/Library/keys/aws-key.pem"', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=ubuntu', '-o', 'ConnectTimeout=10', 'x.x.x.x', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1403001910.72-137077614801868 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1403001910.72-137077614801868 && echo $HOME/.ansible/tmp/ansible-tmp-1403001910.72-137077614801868'"]
我可以看到身份文件不是我想要使用的 id,我的 git 密钥在运行 Ansible 的机器上的 ~/.ssh/ 中。我如何告诉它使用正确的键,或者它为什么不尝试其他键而不是挂起?
我运行 Ansible 时将 'private_key_file' 设置为 aws 密钥。也许这就是问题所在?
我可以通过使用 git 模块的 key_file 变量并将我的 git 私钥上传到我正在配置的服务器来了解这可能是如何实现的。不过我不想这样做,我想从我的 localhost 进行 ssh 转发。
有可能吗?有人可以帮忙吗?
【问题讨论】:
标签: ansible