# Issue using with\_items and git

**URL:** <https://forum.ansible.com/t/issue-using-with-items-and-git/25348>\
**Category:** Ansible Project\
**Created:** [August 28, 2017, 9:38pm UTC](https://forum.ansible.com/t/issue-using-with-items-and-git/25348 "2017-08-28T21:38:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shahar\_L](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@Shahar\_L](https://forum.ansible.com/u/Shahar_L)\
**Post date:** [August 28, 2017, 9:38pm UTC](https://forum.ansible.com/t/issue-using-with-items-and-git/25348/1 "2017-08-28T21:38:41Z")

</div>

Hello,  
I’m trying to add my playbook step to clone from git repo and put the source repo’s and dest folder under group\_vars.

group\_vars:

`

repos:

- { src: “[git@bitbucket.org](mailto:git@bitbucket.org):USER/REPO-Y.git”, dest: “/opt/REPO\_YYY/” }

`

Playbook:  
`

- name: Display all repos  
debug:  
var: item  
with\_items: “{{ repos }}”

- name: gitclone  
git:  
repo: ‘{{ item.src }}’  
dest: ‘{{ item.dest }}’  
accept\_hostkey: yes  
version: ‘{{gitrepo}}’  
key\_file: ~/.keys  
force: yes  
with\_items: “{{ repos }}”

`

Final output:

`

ok: [XXXXX] =\> (item={u’dest’: u’/opt/REPO-YYY’, u’src’: u’git@bitbucket.org:USER/REPO-Y.git’}) =\> {  
“item”: {  
“dest”: “/opt/REPO-YYY”,  
“src”: “[git@bitbucket.org](mailto:git@bitbucket.org):USER/REPO-Y.git”  
}  
}

TASK [ROLE: gitclone] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [XXXX]: FAILED! =\> {“failed”: true, “msg”: “ERROR! ‘item’ is undefined”}  
fatal: [XXXX]: FAILED! =\> {“failed”: true, “msg”: “ERROR! ‘item’ is undefined”}

`

Someone can assist ? there is something that i’m missing here…

Thanks,  
Shahar

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [August 28, 2017, 9:49pm UTC](https://forum.ansible.com/t/issue-using-with-items-and-git/25348/2 "2017-08-28T21:49:40Z")

</div>

The `with_items` on your `git` task is indented 2 spaces too far. Make sure the indentation of `with_items` matches the name of the module you are attempting to use.

---

<div class="post-metadata">

**Author:** ![Shahar\_L](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@Shahar\_L](https://forum.ansible.com/u/Shahar_L)\
**Post date:** [August 28, 2017, 9:58pm UTC](https://forum.ansible.com/t/issue-using-with-items-and-git/25348/3 "2017-08-28T21:58:44Z")

</div>

Working ,  
Thank you !!!
