I am using Ansible and I am having a hard time making the git module works. I have read several posts of people having the same problem, I looked at the ansible doc, well I tried almost everything. I found a clear tutorial that I followed until they use git but again I have a problem when I use my repository... :/ The git task just hangs... no error, it is just stuck!
Here is my host file:
[web]
dev1 ansible_ssh_host=10.0.0.101 ansible_ssh_user=root
This is a vagrant VM running on virtualbox on my computer.
I took the playbook from this tutorial and did all the steps until step 08: https://github.com/leucos/ansible-tuto/tree/master/step-08
I run it on my VM, it works fine, then I add one task "Deploy my code" to use my repository... but this task does not work. It is a private repository on bitbucket. Does it make a difference?
- hosts: web
tasks:
- name: Deploy our awesome application
action: git repo=https://github.com/leucos/ansible-tuto-demosite.git dest=/var/www/awesome-app
tags: deploy
- name: Deploy my code
action: git repo=https://[email protected]/YAmikep/djangotutorial.git dest=/var/www/my-app
tags: deploy
There might be something with the user, or the user running ansible, or the keys, etc, but I tried back and forth for hours and I am even more confused now... I just do not know what to do to debug that now and find out what is wrong and what I am missing.
Thanks.
https://github.com/account/repo-name.git
will not work with a deployment key in an Ansible task. However, the syntax[email protected]:account/repo-name.git
will work in an Ansible task with a valid deployment key. The syntax is subtle but important to notice. – avelishttps
togit
– sankargorthi