当我尝试使用Ansible从Bitbucket克隆存储库时,任务似乎“挂起”了。
在文档中,我找到了一些信息,但我没有使用SSH。
如果任务似乎挂起,请首先验证远程主机是否在known_hosts中。SSH将提示用户授权与远程主机的第一次接触。一种解决方案是在.ssh/config中添加StrictHostKeyChecking no,这将代表用户接受和授权连接。但是,如果您运行为不同的用户(例如将sudo设置为True),例如,root将不会查看用户的.ssh/config设置。
这是我尝试过的两个Playbooks,它们都“挂起”了。
在文档中,我找到了一些信息,但我没有使用SSH。
如果任务似乎挂起,请首先验证远程主机是否在known_hosts中。SSH将提示用户授权与远程主机的第一次接触。一种解决方案是在.ssh/config中添加StrictHostKeyChecking no,这将代表用户接受和授权连接。但是,如果您运行为不同的用户(例如将sudo设置为True),例如,root将不会查看用户的.ssh/config设置。
这是我尝试过的两个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
欢迎任何帮助。提前致谢!