Links
📂

Inventory Variables On Disk

Whether a File-Based or Dynamic inventory is used, a "group_vars/" and "host_vars/" Variable folder can exist alongside an inventory source. This allows variables to be defined in YAML that are added to the inventory, regardless of where it came from.
Reminder: When Does Inventory Apply?
While mentioned earlier, it may help repeating that inventory in Jet is an SSH-only concept and does not apply to local or future deployment modes. In fact, it is an error to specify --inventory when trying to execute a playbook locally.
For file-based inventory, Jet looks alongside the 'groups/' folder to see if there are any files with the same names as the groups. When it looks for files, it looks for files without an extension:
# directory listing
# used by command like:
# jetp [mode] --inventory path/to/inventory [...]
path/to/inventory/
groups/
webservers
boston
group_vars/
webservers
boston
host_vars/
webservers
boston
When using dynamic inventory, Jet looks for the group_vars/ and host_vars/ directories parallel to the inventory scripts used.
# directory listing
# used by command like:
# jetp [mode] --inventory path/to/inventory/dynamic_inventory_script.py [...]
path/to/inventory/
groups/
webservers
boston
group_vars/
webservers
boston
dynamic_inventory_script.py
dynamic_inventory_script.ini
File formats are the same regardless of the inventory type.
Both 'group_vars/' and 'host_vars/' files are YAML hashes like so:
asdf: 1234
a_list:
- one
- two
- three
a_nested_nash:
dog: fido
cat: fluffy
We strongly suggest keeping the inventory folder in source control, possibly as a seperate repository from the playbook content.