我试图使用Ansible从我的两个Git repos中提取,但我似乎得到了这个错误:
failed: [app01] (item={u'dest': u'/etc/', u'repo': u'Vigorate'}) =>{"failed": true, "item": {"dest": "/etc/", "repo": "Vigorate"}, "msg": "Failed to find required executable git"}
failed: [app01] (item={u'dest': u'/etc/', u'repo': u'Paint-UI'}) => {"failed": true, "item": {"dest": "/etc/", "repo": "Paint-UI"}, "msg": "Failed to find required executable git"}
我的git.yml剧本看起来像这样:
编辑:
- hosts: app01
vars:
- destination: /home/vagrant/rep
tasks:
- name: Install dependencies
apt: name={{ item }} state=present
with_items:
- htop
- git-all
- name: Pull from Git
git: repo=http://git@github.com/*****/{{ item.repo }}.git
dest={{ item.dest }}
# accept_hostkey=yes
# force=yes
# recursive=no
with_items:
-
dest: "{{ destination }}"
repo: RepoEexample
# -
# dest: "{{ destination }}"
# repo: RepoExample
任何帮助将不胜感激
答案 0 :(得分:3)
我认为这个错误表明您的ansible剧本中的git:
无法识别并且不存在。您希望在使用之前确保已安装git。类似的东西:
- name: Install dependencies
yum: name={{ item }} state=present
with_items:
- htop
- git-all
- python-devel
会安装htop,git和python,然后运行你的git
节。
如果您确定已安装git,则下一个可能的错误可能是with_items
部分的语法。尝试将其分解为两个不同的代码节(繁琐,是的)只是为了确保它有效,如果确实如此,它是当前版本的格式而不是git问题。
---------- UPDATE
确保以下内容有效,然后专注于使用单个代码段克隆多个repos。
- name: Pull from Git
git: repo=git@github.com/daniyalj/Vigorate.git
dest=/path/to/destination