Hi I have enterprise git server where I created a private test-repo
and added a ssh-key on the deploy ssh key form. I defined a git
role in my common roles which is having below yml definition.
---
- name: github enterprise private key
copy: >
src=id_rsa_ghe
dest=/etc/id_rsa_ghe
owner=root
group=root
mode=0600
- name: clone test-repo project
git:
repo: git@git.example-private.com:code/test-repo.git
dest: /etc/test-repo
accept_hostkey: true
key_file: /etc/id_rsa_ghe
in roles/common/git
I defined files
folder where I put my private key for git clone however I am still getting error as below
fatal: [localhost]: FAILED! => {"changed": false, "cmd": ["/usr/bin/git", "fetch", "--tags", "origin"], "failed": true, "msg": "Failed to download remote objects and refs: ERROR: Repository not found.\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n"}
Below are my system details. And I am running this playbook locally on one of my server.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
$ansible --version
ansible 2.2.1.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
Below is the actual error which I get repository not found.
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/core/source_control/git.py <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "
echo ~/.ansible/tmp/ansible-tmp-1487398723.48-100968102221507
" && echo ansible-tmp-1487398723.48-100968102221507="echo ~/.ansible/tmp/ansible-tmp-1487398723.48-100968102221507
" ) && sleep 0' <127.0.0.1> PUT /tmp/tmp2Bijvu TO /home/ubuntu/.ansible/tmp/ansible-tmp-1487398723.48-100968102221507/git.py <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/ubuntu/.ansible/tmp/ansible-tmp-1487398723.48-100968102221507/ /home/ubuntu/.ansible/tmp/ansible-tmp-1487398723.48-100968102221507/git.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python /home/ubuntu/.ansible/tmp/ansible-tmp-1487398723.48-100968102221507/git.py; rm -rf "/home/ubuntu/.ansible/tmp/ansible-tmp-1487398723.48-100968102221507/"/dev/null 2>&1 && sleep 0' fatal: [localhost]: FAILED! => { "changed": false, "cmd": [ "/usr/bin/git", "fetch", "--tags", "origin" ], "failed": true, "invocation": { "module_args": { "accept_hostkey": true, "bare": false, "clone": true, "depth": null, "dest": "/etc/dotfiles", "executable": null, "force": false, "key_file": "/etc/id_rsa_ghe", "recursive": true, "reference": null, "refspec": null, "remote": "origin", "repo": "git@git.example-private.com:code/test-repo.git", "ssh_opts": null, "track_submodules": false, "umask": null, "update": true, "verify_commit": false, "version": "HEAD" }, "module_name": "git" }, "msg": "Failed to download remote objects and refs: ERROR: Repository not found.\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n" }
git
? How do you do it?-vvv