Issue using with_items and git

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:

`

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: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

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.

Working ,
Thank you !!!