# Keeping inventory and other data separate from code

**URL:** <https://forum.ansible.com/t/keeping-inventory-and-other-data-separate-from-code/36502>\
**Category:** Ansible Project\
**Created:** [April 2, 2022, 2:26am UTC](https://forum.ansible.com/t/keeping-inventory-and-other-data-separate-from-code/36502 "2022-04-02T02:26:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_Hector](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@Richard\_Hector](https://forum.ansible.com/u/Richard_Hector)\
**Post date:** [April 2, 2022, 2:26am UTC](https://forum.ansible.com/t/keeping-inventory-and-other-data-separate-from-code/36502/1 "2022-04-02T02:26:48Z")

</div>

Hi all,

Currently my inventory is stored in the same git repo as my play(book)s, roles etc, which I don't like.

What are common ways to avoid this? Perhaps keep inventory in a subdir which is .gitignored, and make that a separate repo?

I also want to keep data which is not strictly inventory - eg lists of users, ssh keys etc which are specific to my site/business, but shared across many hosts and groups. I think I need to use lookups to access this. Perhaps that data and inventory can go together in that other repo?

eg:

/home/richard/ansible/  
&nbsp;&nbsp;&nbsp;.git/  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.gitignore (ansible/data)  
&nbsp;&nbsp;&nbsp;.ansible.cfg  
&nbsp;&nbsp;&nbsp;/data  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.git/  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/inventory  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hosts  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/host\_vars  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/group\_vars  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;users.yml  
&nbsp;&nbsp;&nbsp;/plays  
&nbsp;&nbsp;&nbsp;/roles

Does that seem reasonable?

That way, if (when) I have questions in the future, I can refer you all to my ansible repo without sharing the private data 🙂

Are there better ways to do this?

Cheers,  
Richard

---

<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:** [April 2, 2022, 3:07am UTC](https://forum.ansible.com/t/keeping-inventory-and-other-data-separate-from-code/36502/2 "2022-04-02T03:07:07Z")

</div>

> Hi all,
> 
> Currently my inventory is stored in the same git repo as my play(book)s,  
> roles etc, which I don't like.

Consider using git submodules if you want a unified workspace.

---

<div class="post-metadata">

**Author:** ![Richard\_Hector](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@Richard\_Hector](https://forum.ansible.com/u/Richard_Hector)\
**Post date:** [April 16, 2022, 9:57am UTC](https://forum.ansible.com/t/keeping-inventory-and-other-data-separate-from-code/36502/3 "2022-04-16T09:57:55Z")

</div>

> > Hi all,
> > 
> > Currently my inventory is stored in the same git repo as my play(book)s,  
> > roles etc, which I don't like.
> 
> Consider using git submodules if you want a unified workspace.

Hmm. I got thoroughly confused by submodules last time I tried them. And didn't Linus say he regretted having devised them in the first place?

Is there an easy way to have a non-unified workspace, so that I can use separate repos more easily?

Cheers,  
Richard
