# referring file from different repo

**URL:** <https://forum.ansible.com/t/referring-file-from-different-repo/38725>\
**Category:** Ansible Project\
**Created:** [March 22, 2024, 7:18am UTC](https://forum.ansible.com/t/referring-file-from-different-repo/38725 "2024-03-22T07:18:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thirumalairaja](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@thirumalairaja](https://forum.ansible.com/u/thirumalairaja)\
**Post date:** [March 22, 2024, 7:18am UTC](https://forum.ansible.com/t/referring-file-from-different-repo/38725/1 "2024-03-22T07:18:06Z")

</div>

Hello guys,

below is my playbook, actually i have csv file called subnetsheet in my git repo where i have kept my playbook, in my first task i am reading my yaml file and then based on the value “location\_network” i am reading CSV file and get some of the data which was working as i am expected.

here my question is can i keep my CSV file in a different git repo, if yes how can i call that csv file from this current repo.  
I am trying to keep a single csv file as I have branches. If I modify the csv data in amy of those branch it’s getting conflicting so I want to keep a single csv file. If anyone has any idea pls help me.

tasks:

- name: read vm\_data  
set\_fact:  
vm\_data: “{{ lookup(‘file’, ‘variables/vm\_data.yaml’) | from\_yaml }}”  
tags:

- read-vm\_data

- name: getting IP\_scope  
getip\_scope:  
csv\_file: template/subnetsheet.csv  
location\_network: “{{ location\_network }}”  
register: vm\_data  
tags:

- get-ip-sco

regards,  
Thirumalai Raja.

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [March 23, 2024, 1:51pm UTC](https://forum.ansible.com/t/referring-file-from-different-repo/38725/2 "2024-03-23T13:51:42Z")

</div>

This isn’t so much an Ansible question as it is a Git question. But that’s okay.

The problem you’ve described is exactly what [git submodules](https://git-scm.com/docs/gitsubmodules) are intended to address. The problem with submodules is that almost nobody uses them, so you’ll find very little in the way of support of “the community”. If you use them, you’ll end up being the local expert on them.

Git submodules allow you to embed a git project inside another project. In your case, you’ll be embedding the project containing the CSV file into multiple other git projects. That should be fine as long as you keep things up-to-date.

Good luck with that!

---

<div class="post-metadata">

**Author:** ![Nico\_Kadel-Garcia](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/nico_kadel-garcia/32/9998_2.png) [@Nico\_Kadel-Garcia](https://forum.ansible.com/u/Nico_Kadel-Garcia)\
**Post date:** [March 23, 2024, 6:17pm UTC](https://forum.ansible.com/t/referring-file-from-different-repo/38725/3 "2024-03-23T18:17:46Z")

</div>

> This isn't so much an Ansible question as it is a Git question. But that's okay.
> 
> The problem you've described is exactly what git submodules are intended to address. The problem with submodules is that almost nobody uses them, so you'll find very little in the way of support of "the community". If you use them, you'll end up being the local expert on them.
> 
> Git submodules allow you to embed a git project inside another project. In your case, you'll be embedding the project containing the CSV file into multiple other git projects. That should be fine as long as you keep things up-to-date.

By repository name, not by individual file. It's not necessarily  
efficient. It's normally possible to export a file from a git repo as  
needed. Take a look at the GUI for your repo and look for the  
individual file, and the how do display it "raw" if you're having  
trouble exporting it.
