Thanks @mkrizek! Following the link that he posted I rewrote the example and it works now. I’m going to post here the code that I rewrote just in case someone has a similar issue.
- name: Configure repository's git_config
git_config:
name: "{{ item.config_name }}"
value: "{{ item.config_value }}"
scope: local
repo: "{{ item.path }}"
loop: |
{%- set result = [] -%}
{%- for repo_name, repo_data in src_repositories_to_deploy.items() -%}
{%- for git_config_key, git_config_value in repo_data.git_config.items() -%}
{%- set _ = result.append({
"repo_name": repo_name,
"path": src_home + "/" + repo_name,
"config_name": git_config_key,
"config_value": git_config_value,
})
-%}
{%- endfor -%}
{%- endfor -%}
{{ result }}