无法使用ansible克隆git repo

时间:2016-11-28 10:42:45

标签: git ssh ansible ansible-2.x

我刚刚升级到ansible 2.2(以获得2.1中没有的systemd任务功能),现在我无法克隆我的应用程序仓库。

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

有问题的剧本是:

- name: Checkout Django application
  become: no
  git: repo=git@bitbucket.org:myusername/application.git
       dest=/tmp/myapplication
       accept_hostkey=True

我已经启用了主机密钥转发(正如我所说,这个游戏之前正在运行)。 ssh -T git@bitbucket.org -i $HOME/.ssh/my_ssh_key有效。

这里有详细的输出:

Using module file /usr/lib/python2.7/dist-packages/ansible/modules/core/source_control/git.py
<111.222.333.444> ESTABLISH SSH CONNECTION FOR USER: deploy
<111.222.333.444> SSH: EXEC ssh -vvv -o ForwardAgent=yes -o StrictHostKeyChecking=no -o 'IdentityFile="/home/me/.ssh/my_ssh_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 111.222.333.444 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1480328606.84-68734816115955 `" && echo ansible-tmp-1480328606.84-68734816115955="` echo $HOME/.ansible/tmp/ansible-tmp-1480328606.84-68734816115955 `" ) && sleep 0'"'"''
<111.222.333.444> PUT /tmp/tmpRIvaKP TO /home/deploy/.ansible/tmp/ansible-tmp-1480328606.84-68734816115955/git.py
<111.222.333.444> SSH: EXEC sftp -b - -vvv -o ForwardAgent=yes -o StrictHostKeyChecking=no -o 'IdentityFile="/home/me/.ssh/my_ssh_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 '[111.222.333.444]'
<111.222.333.444> ESTABLISH SSH CONNECTION FOR USER: deploy
<111.222.333.444> SSH: EXEC ssh -vvv -o ForwardAgent=yes -o StrictHostKeyChecking=no -o 'IdentityFile="/home/me/.ssh/my_ssh_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 111.222.333.444 '/bin/sh -c '"'"'chmod u+x /home/deploy/.ansible/tmp/ansible-tmp-1480328606.84-68734816115955/ /home/deploy/.ansible/tmp/ansible-tmp-1480328606.84-68734816115955/git.py && sleep 0'"'"''
<111.222.333.444> ESTABLISH SSH CONNECTION FOR USER: deploy
<111.222.333.444> SSH: EXEC ssh -vvv -o ForwardAgent=yes -o StrictHostKeyChecking=no -o 'IdentityFile="/home/me/.ssh/my_ssh_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -tt 111.222.333.444 '/bin/sh -c '"'"'/usr/bin/python /home/deploy/.ansible/tmp/ansible-tmp-1480328606.84-68734816115955/git.py; rm -rf "/home/deploy/.ansible/tmp/ansible-tmp-1480328606.84-68734816115955/" > /dev/null 2>&1 && sleep 0'"'"''

编辑:downvote?请随意评论问题中的任何歧义,以便我可以解决它......

1 个答案:

答案 0 :(得分:0)

在我的控制机器升级期间(在此期间我升级了Ansible),我从ssh代理删除了相关的密钥条目。确认:

ssh-add -L

并将钥匙添加回来:

ssh-add ~/.ssh/my_ssh_key