Ansible Mercurial克隆挂起
当我尝试使用Ansible从Bitbucket克隆存储库时,似乎任务“挂起”.
在documentation我找到了一些信息,但我没有使用SSH.
这些是我试过的两本Playbooks.他们都“挂”. 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 欢迎任何帮助.提前致谢! 解决方法
我为那些想要克隆私有存储库的人找到了更好的答案. Bitbucket具有称为“部署密钥”的功能.登录您的项目,进入“设置”和“部署密钥”. “添加密钥”,然后在项目部署过程中,在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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |