【问题标题】:Git Ansible Clone issueGit Ansible 克隆问题
【发布时间】:2015-11-17 06:55:19
【问题描述】:

我有一个 git repo,下面是我的 ansible 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

当我运行上述任务时,它会无休止地挂起/等待。我尝试调试,发现当我将 git host 添加到已知主机(手动进入服务器然后添加),然后运行这个 playbook 时,它工作正常。

虽然我已将accept_hostkey 设置为yes,但它仍然挂断或无休止地等待。

如何使用上面的剧本克隆一个 git repo?

【问题讨论】:

  • 您是否尝试开启详细模式?
  • 我试过了。它仍然挂起或无休止地等待。
  • 那是什么O/P?
  • 没什么..它只是焦虑...
  • 您的机器或网络中有防火墙吗?使用 ssl 有问题?

标签: git ansible


【解决方案1】:
---
- 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

这可能会对您有所帮助。 Accept_hostkey 我正在处理它。完成后我会更新你。

谢谢

【讨论】:

    猜你喜欢
    • 2011-03-08
    • 2013-10-03
    • 2021-06-03
    • 2010-11-20
    • 2022-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多