I’m having trouble with the git module. It works via ansible but not ansible playbook. The arguments are exactly the same. I can ssh into the server and do a git clone from the command line in the target folder as well. Does ansible-playbook require different params for the git module?
I’m having trouble with the git module. It works via ansible but not ansible playbook. The arguments are exactly the same. I can ssh into the server and do a git clone from the command line in the target folder as well. Does ansible-playbook require different params for the git module?
name: Get myrepo
action: git repo=git@bitbucket.org:nflacco/myrepo.git dest=/srv/checkout/myrepo
Here is the command line output (with verbose), after I manually stop it because it hangs ad infinium:
TASK: [Install Git] *********************
ok: [www.myserver.com] => {“changed”: false, “msg”: “”, “rc”: 0, “results”: [“All packages providing git are up to date”]}
TASK: [Get myrepo] *********************
^C32
ERROR: interupted
When I use more than the stub playbook above (copy git ssh keys and bunch of other stuff), ansible-playbook creates an empty folder (with .git subfolder) and hangs.
+1 for me, I noticed that same behaviour with ansible-playbook. Didn’t test with plain ansible though.
Repeated executions? I can execute the ansible command over and over, but the playbook one doesn’t work from the start, apart from a creating the destination folder and .git subfolder.
With a clean destination the ansible command works great. The folder appears in the destination.
When using the git module to deploy ansible from github, no problem.
When jusing the git module to deploy/update out ansible data repository, it hangs.
Looking at our internal “git server”, I see these processes, all sleeping:
Based on the above, it appears you are using the git module with different
users. Can you confirm? If so, are both users set up with the same ssh
key to access the git repo via ssh?
It appears, based on your ps listing in a subsequent email, that ssh is
hanging on something. Is the ssh key password protected? Is ssh-agent, or
some similar mechanism, already running? Have you tried strace'ing that
process to see what it is waiting on?
Based on the above, it appears you are using the git module with different users. Can you confirm? If so, are both users set up with the same ssh key to access the git repo via ssh?
I’m not sure based on what you conclude this. Ansible-playbook runs from a local user on my machine and connects with root on the target machine.
It appears, based on your ps listing in a subsequent email, that ssh is hanging on something. Is the ssh key password protected? Is ssh-agent, or some similar mechanism, already running? Have you tried strace’ing that process to see what it is waiting on?
The target machine has a ssh key managed by keychain which permits it to log on the “git ssh server” (with user git).
This must be my issue: the ansible runner isn’t aware of the keychain environment as it doesn’t load the shell environment, which is a problem on my side of course, not an ansible problem.
Same issue here. I messed around with it for a few hours but ultimately chose to put ansible commands into a batch file instead of using a playbook. Works fine that way.
I got past this yesterday but I was just able to reproduce the problem on a fresh instance.
by killing the “ssh git@github.com git-upload-pack” process while it was hanging, the problem reveals itself to be that the git server is not a known host…
"RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. Are you sure you want to continue connecting (yes/no)?"
at which point git ( and everything else) hangs.
I guess the workaround would be to add your git server to .ssh/known_hosts before firing off the git module.
Oh…haha… and now that I was just looking to see if there was an Ansible “known_hosts” module ala the one for authorized_keys, I notice this exact issue is mentioned in the documentation for the HG module. Perhaps it can be added to the docs for Git.
Just for the record, even with this trouble on my first experience with Ansible, I was so impressed that I didn’t abandon it even after hours of dealing with this issue.
Thanks to the makers!
That needs to be me in the git module docs under 'notes'.
Someone please send me a patch.
If there are git flags to ignore this, it would be very nice to add
them, but it's a little tricky over ssh:// transport
I imagine lots of people will also be doing deployments over git://
and http:// when the goal of the deployment is not to create a
development environment.
Piggybacking off this thread as it seems related.So, I’m new to ansible, and i have been trying to clone a private repo onto my webserver by doing the following task:
I get “ping: unknown host github.com” so it seems like i’m getting the same problem that you had.
I’m not super familiar with all this key, known hosts, and authenticating stuff (raises hand when asked for noob)
so if possible can you give me a play by play on how you solved your problem?
I am assuming I would need to copy the id_rsa/id_rsa.pub file from my local machine (which i use to authenticate
with my private repo) to the server, so that i could clone from my server.
The error messages you are getting suggest that it is a DNS issue, not an SSH authentication issue. Can you show us the contents of the /etc/resolv.conf file on the remote machine?
The resolve.conf file is empty. I am currently fiddling around with ansible and vagrant. Following this tutorial: https://github.com/leucos/ansible-tuto/tree/master/step-01 I’ve managed to set up a LAMP server with the host file containing