referring file from different repo

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.

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.

Good luck with that!

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.