Documenting inventory directories

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!

I’m definitely ok with this.

Is this something you’d like to work on?

Should be a very small patch.

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