builtin.git fails to clone private repo

84 views
Skip to first unread message

Don Bower

unread,
Oct 31, 2022, 6:22:59 PM10/31/22
to Ansible Project
Here is my task: 
 - name: Install Private Git Repos
git:
repo: "{{ item.repo }}"
dest: "/home/don/Developer/{{ item.dest }}"
with_items:
- repo: g...@github.com:DonBower/ansible.git
dest: ansible

I can do this manually from the target hosts command line, but running ansible-playbook results in:
failed: [ideapad-ubuntu.ag6hq.net] (item={'repo': 'g...@github.com:DonBower/ansible.git', 'dest': 'ansible'}) => {
"ansible_loop_var": "item",
"changed": false,
"cmd": [
"/usr/bin/git",
"fetch",
"--tags",
"origin"
],
"invocation": {
"module_args": {
"accept_hostkey": false,
"accept_newhostkey": false,
"archive": null,
"archive_prefix": null,
"bare": false,
"clone": true,
"depth": null,
"dest": "/home/don/Developer/ansible",
"executable": null,
"force": false,
"gpg_whitelist": [],
"key_file": null,
"recursive": true,
"reference": null,
"refspec": null,
"remote": "origin",
"repo": "g...@github.com:DonBower/ansible.git",
"separate_git_dir": null,
"single_branch": false,
"ssh_opts": null,
"track_submodules": false,
"umask": null,
"update": true,
"verify_commit": false,
"version": "HEAD"
}
},
"item": {
"dest": "ansible",
"repo": "g...@github.com:DonBower/ansible.git"
},
"msg": "Failed to download remote objects and refs: Host key verification failed.\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n"
}

What am I doing wrong?


Todd Lewis

unread,
Oct 31, 2022, 11:09:22 PM10/31/22
to Ansible Project
You have both
   "accept_hostkey": false,
   "accept_newhostkey": false

Does it run as you, or do you "--become"? Because there appears to be no key for github.com in that user's ~/.ssh/known_hosts file.
Reply all
Reply to author
Forward
0 new messages