2016-11-11 15 views
1

을 통해 개인의 bitbucket의 REPO를 복제 할 수 없습니다 I ansible.cfg는 ansible

sudo_flags = -H -S -n 
[ssh_connection] 
ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes 

- name: Fetch code from git repo 
    git: repo={{repo_url}} 
     dest={{ proj_path }} 
     version={{ repo_version }} 
     accept_hostkey=yes 
     force=true 

에서 다음과 같은 구성이 나는 또한 오류 메시지가이 일

전에 sudo를로 실행 동일한 작업이 점을 명심해야 :

Warning: Permanently added the RSA host key for IP address '2401:1d80:1010::150' to the list of known hosts.\r\nPermission denied (publickey).\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.", "rc": 128, "stderr": "Warning: Permanently added the RSA host key for IP address '2401:1d80:1010::150' to the list of known hosts.\r\nPermission denied (publickey).\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n", "stdout": "", "stdout_lines": []} 
+0

복제하려는 호스트의 키를 삭제 해 보았습니까? ~/.ssh/known_hosts 및 ~/.ssh/authrozed_keys에 잘못된 키가있는 것 같습니다. –

답변

2

그 오류 메시지 중 하나 Ansible 키를 사용하지 않는 키 Ansible가의 Bitbucket의 REPO에서 복제 할 수있는 권한이 없습니다 사용, 또는 그 것을 그것이 있어야 나타냅니다 사용. 그 메시지에서 그 문제가 무엇인지 명확하게 알 수 없으므로, 무슨 일이 일어나고 있는지 파악하기 위해 조금 파헤쳐 야 할 것입니다.


첫째, ssh -i /path/to/key [email protected]와 키의 권한을 테스트합니다.

Permission denied (publickey)을 얻은 경우 해당 키는 사용자와 관련되지 않으며 모든 repo의 배포 키로 추가됩니다. 공개 키를 필요로하는 사용자 또는 저장소에 공개 키를 추가하십시오.

이 같은 얻을 경우 - 다음 키가 해당 사용자의 계정과 연결된를

logged in as some-username-here. 

You can use git or hg to connect to Bitbucket. Shell access is disabled. 
Connection to bitbucket.org closed. 

.

이 같은 얻을 경우 -

authenticated via a deploy key. 

You can use git or hg to connect to Bitbucket. Shell access is disabled. 

This deploy key has read access to the following repositories: 

다음 키 배치로 추가됩니다 사람들의 repos에 (즉, 읽기 전용) 키를 누릅니다.


키의 권한이 양호한 경우 ssh-agent가 실행 중이 아니거나 키를 알 수 없습니다. 이런 식으로 ssh_args를 업데이트 해보십시오 : 지정된 키를 사용하여 연결 Ansible을 강제

ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes -i /path/to/key 

.