Ansible Mercurial clone hangs -
when try clone repository bitbucket ansible, seems task 'hangs'.
in documentation have found information, i'm not using ssh.
if task seems hanging, first verify remote host in known_hosts. ssh prompt user authorize first contact remote host. 1 solution add stricthostkeychecking no in .ssh/config accept , authorize connection on behalf of user. however, if run different user such setting sudo true), example, root not @ user .ssh/config setting.
these 2 playbooks i've tried. both 'hangs'.
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://bbusername@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://bbusername@bitbucket.org/username/my-repo
any welcome. in advance!
i found better answer want clone private repository. bitbucket has feature called "deployment keys". login project, go "settings" , "deployment keys". "add key" , provide key within project deployment process, before hg:
- file: dest=/var/www/someuser/.ssh/config state=touch mode=600 - lineinfile: dest=/var/www/someuser/.ssh/config line="host bitbucket.org" state=present - copy: src=someuser.key dest=/var/www/someuser/.ssh/id_rsa mode=0600 - copy: src=someuser.key.pub dest=/var/www/someuser/.ssh/id_rsa.pub mode=0600 - lineinfile: dest=/var/www/someuser/.ssh/config line="identityfile ~/.ssh/id_rsa" - lineinfile: dest=/var/www/someuser/.ssh/config line=" stricthostkeychecking no" insertafter="host bitbucket.org" state=present - name: install site code hg: repo='ssh://hg@bitbucket.org/somecode' dest=someuser revision=stable tags: someuser_code
Comments
Post a Comment