简体   繁体   English

Git Ansible克隆问题

[英]Git Ansible Clone issue

I've a git repo and following is my ansible git code. 我有一个git repo,下面是我的ans git代码。

---
 - name: read-write git checkout from repo
   git:
    repo: "{{repo_url}}"
    dest: "{{webapps_dir}}/{{app_name}}"
    accept_hostkey: yes
    force: yes
    remote: "{{repo_remote}}"
    version: "{{repo_branch}}"
   register: gitrepo

When I run the above task, it hangs-up/waits endlessly. 当我运行上述任务时,它挂断/等待不休。 I tried debugging and found out that when I add git host to the known hosts (manually going onto the server and then ading) , and then run this playbook, it works fine. 我尝试调试,发现将git host添加到已知主机(手动进入服务器,然后进行ading),然后运行此剧本时,它工作正常。

Although I've set accept_hostkey to yes , it still hangs up or waits endlessly. 尽管我将accept_hostkey设置为yes ,它仍然挂断或无休止地等待。

How can I clone a git repo using the above playbook? 如何使用上述剧本克隆git repo?

---
- hosts: all
  gather_facts: no
  become: yes
  vars_prompt:
    - name: "gituser"
      prompt: "Enter your gitlab ID or username ex: user@XXXX.XXX"
      private: no
    - name: "gitpassword"
      prompt: "Enter your gitlab password"
      private: yes

  tasks:
    - name: Cloning from git 
      git:
        repo: "https://{{ gituser | urlencode }}:{{ gitpassword | urlencode }}@git###.####.###/group/projects.git"
        dest: /usr/share/clonefolder
        clone: yes
        update: yes
        force: yes

This may help you. 这可能对您有帮助。 Accept_hostkey im working on it. Accept_hostkey我正在处理它。 i will update you once i complete it. 完成后,我会更新您的信息。

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM