Documenting inventory directories

59 views
Skip to first unread message

Quentin Stafford-Fraser

unread,
Aug 29, 2014, 7:18:40 AM8/29/14
to ansible...@googlegroups.com
I love the 'inventory directory' feature, and typically have directories called, e.g:

* inventory/staging/
* inventory/live/
* inventory/docker/
* inventory/local/

but I would sometimes like to document in each one how to use them, and what they do.

At present, if you specify a directory as the inventory, it will load any regular files within it as inventory files and execute any scripts as inventory scripts.

It ignores any files that match

    "~", ".orig", ".bak", ".ini", ".retry", ".pyc", ".pyo"

Can I propose that a few extras be added to that list, perhaps:

"*.txt", "*.doc", "*.md"

so you can put a README.txt in the directory without it being interpreted as an inventory?

Other alternatives:

* You could require things that were actually inventory files to have a particular naming structure
* You could have a .exclude file which listed files to be ignored

At present, my workaround is to put a README.txt in each one but to begin every line with a '#'. It is then read as an inventory file but ignored!



Michael DeHaan

unread,
Aug 29, 2014, 7:43:44 AM8/29/14
to ansible...@googlegroups.com
I'm definitely ok with this.

Is this something you'd like to work on?

Should be a very small patch.




--
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 post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/44e49123-19ce-437f-a1c7-d2938c36be1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Quentin Stafford-Fraser

unread,
Aug 31, 2014, 9:26:10 AM8/31/14
to ansible...@googlegroups.com
Michael - 

A pull request will be coming your way shortly.

I've excluded README* files by default, and also allowed a directory to include an '.inventoryignore' file (analagous to .gitignore) which lists patterns of files to be ignored in place of the defaults.

All the best, 
Quentin
Reply all
Reply to author
Forward
0 new messages