firebolt
firebolt

Reputation: 139

Error when pulling from git in ansible - {Failed to find required executable git}

I am trying to pull from two of my Git repos using Ansible but I seem to be getting this error:

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"}

My git.yml playbook looks like this:

EDIT:

- 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://[email protected]/*****/{{ item.repo }}.git
       dest={{ item.dest }}
      # accept_hostkey=yes
      # force=yes
      # recursive=no
  with_items:
    -
      dest: "{{ destination }}"
      repo: RepoEexample
  #  -
   #   dest: "{{ destination }}"
    #  repo: RepoExample

Any help would be appreciated

Upvotes: 1

Views: 7406

Answers (1)

Laughing Horse
Laughing Horse

Reputation: 158

I believe this error suggests that the git: in your ansible playbook is unrecognized and doesn't exist. You want to make sure that you've installed git before using it. Something like:

 - name: Install dependencies
   yum: name={{ item }} state=present
   with_items:
     - htop
     - git-all
     - python-devel

would install htop, git, and python so then you run your git stanza.

If you're sure git is installed, then the next possible error might be the syntax of your with_items section. Try breaking it up into two different stanzas of code (tedious, yes) just to make sure it works and if it does, it's the formatting of current version and not a git problem.

----------UPDATE

Make sure the below works and then focus on having multiple repos cloned with the single stanza of code.

- name: Pull from Git
  git: [email protected]/daniyalj/Vigorate.git
       dest=/path/to/destination

Upvotes: 4

Related Questions