Re: [ansible-project] Mercurial clone repository hangs

601 views
Skip to first unread message

Michael DeHaan

unread,
May 9, 2013, 9:25:26 AM5/9/13
to ansible...@googlegroups.com
Definitely post questions here and not on StackOverflow, everybody's here, and I don't post there either.

I'm not a bitbucket user (others in community land contributed the module), but I would assume the problem is you are not supplying the password when you are cloning the repo?

That would be true of github. 





On Thu, May 9, 2013 at 4:27 AM, Niels Dequeker <niels.d...@gmail.com> wrote:
Hello everyone

I am starting with Ansible and I really like it so far. But at the moment I'm kinda stuck, because I can't clone from a repository.
I have also posted this question on StackOverflow, but it seems that there is more activity on this Google Usergroup.

When I try to clone a repository from Bitbucket with Ansible, it seems like the task 'hangs'.
In the I have found some information, but I'm not using SSH.

If the task seems to be hanging, first verify remote host is in
known_hosts. SSH will prompt user to authorize the first contact with
a remote host. One solution is to add StrictHostKeyChecking no in
.ssh/config which will accept and authorize the connection on behalf
of the user. However, if you run as a different user such as setting
sudo to True), for example, root will not look at the user .ssh/config
setting.

These are the two Playbooks I've tried. They both 'hang'.

Playbook #1
    - hosts: staging_mysql
      user: ec2-user
      sudo: yes
    
      vars_files:
        - vars/mercurial.yml
    
      tasks:
        - name: Mercurial credentials setup
          action: template src=templates/hgrc.j2 dest=/home/ec2-user/.hgrc
    
        - name: Install Mercurial
          action: yum name=hg
        
        - name: Setup API repository
          action: command hg clone https://bbuse...@bitbucket.org/username/my-repo -r default --debug
    
Playbook #2

    - hosts: staging_mysql
      user: ec2-user
      sudo: yes
    
      vars_files:
        - vars/mercurial.yml
    
      tasks:
        - name: Mercurial credentials setup
          action: template src=templates/hgrc.j2 dest=/home/ec2-user/.hgrc
    
        - name: Install Mercurial
          action: yum name=hg
        
        - name: Clone API repo
          hg: dest=/home/ec2-user repo=https://bbuse...@bitbucket.org/username/my-repo

Any help is welcome as I'd like to continue with Ansible. Thanks in advance!

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Michael DeHaan <mic...@ansibleworks.com>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/

shirou

unread,
May 9, 2013, 8:34:59 PM5/9/13
to ansible...@googlegroups.com
Hi, Niels,

I can clone on my localhost with following playbook.

-------------------------
- hosts: localhost
user: shirou
sudo: no
tasks:
- name: Clone API repo
hg: dest=/tmp/ansible-test
repo=https://r_r...@bitbucket.org/r_rudi/ansible-test
-------------------------

Could you show me the more information by using -vvv option?
(or 'hangs' meens not responded for a long time?)

Regards,
WAKAYAMA Shirou


2013/5/9 Michael DeHaan <mic...@ansibleworks.com>:

Andrew Pashkin

unread,
May 22, 2014, 8:00:53 AM5/22/14
to ansible...@googlegroups.com
I have this issue too. I use SSH repo access, and I think that Ansible just hangs on this:
The authenticity of host 'bitbucket.org (131.103.20.167)' can't be established.
RSA key fingerprint is 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40.
Are you sure you want to continue connecting (yes/no)?
It happens when I try to clone manually from SSH.


On Friday, May 10, 2013 4:34:59 AM UTC+4, Shirou w wrote:
Hi, Niels,

I can clone on my localhost with following playbook.

-------------------------
- hosts: localhost
  user: shirou
  sudo: no
  tasks:
    - name: Clone API repo
      hg: dest=/tmp/ansible-test
>>
>> Playbook #2
>>
>>     - hosts: staging_mysql
>>       user: ec2-user
>>       sudo: yes
>>
>>       vars_files:
>>         - vars/mercurial.yml
>>
>>       tasks:
>>         - name: Mercurial credentials setup
>>           action: template src=templates/hgrc.j2 dest=/home/ec2-user/.hgrc
>>
>>         - name: Install Mercurial
>>           action: yum name=hg
>>
>>         - name: Clone API repo
>>           hg: dest=/home/ec2-user

linbo liao

unread,
May 22, 2014, 10:25:38 PM5/22/14
to ansible...@googlegroups.com
Haven't used hg, but for git, two solutions:

1. add password in repo url, like:  https://bbusername:password@bitbucket.org/username/my-repo 

2. setup ssh key, git module has ssh key option.

Now I am searching a solution to pass the password from terminal, like enter ssh password in terminal when use ansible -u user -k, but no idea how to solve it.

Thanks,
Linbo 

在 2013年5月9日星期四UTC+8下午4时27分09秒,Niels Dequeker写道:

Michael DeHaan

unread,
May 23, 2014, 8:32:52 AM5/23/14
to ansible...@googlegroups.com
The git module contains some logic to auto-accept the hostkey.

Looks like you'll need to manually add it before the checkout since this hasn't been added there yet.

(Pull requests would be welcome - take a look at the git module for details).




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages