Keeping inventory and other data separate from code

37 views
Skip to first unread message

Richard Hector

unread,
Apr 1, 2022, 10:27:04 PM4/1/22
to Ansible Project
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/
.git/
.gitignore (ansible/data)
.ansible.cfg
/data
.git/
/inventory
hosts
/host_vars
/group_vars
users.yml
/plays
/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

Nico Kadel-Garcia

unread,
Apr 1, 2022, 11:07:27 PM4/1/22
to ansible...@googlegroups.com
On Fri, Apr 1, 2022 at 10:27 PM Richard Hector <ric...@walnut.gen.nz> wrote:
>
> 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.
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c0b602a7-b40e-7254-f153-c98a49dd3046%40walnut.gen.nz.

Richard Hector

unread,
Apr 16, 2022, 5:58:11 AM4/16/22
to ansible...@googlegroups.com
On 2/04/22 16:07, Nico Kadel-Garcia wrote:
> On Fri, Apr 1, 2022 at 10:27 PM Richard Hector <ric...@walnut.gen.nz> wrote:
>>
>> 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
Reply all
Reply to author
Forward
0 new messages