💾 Archived View for koyu.space › vydyck › tech › linux › ansible › index.gmi captured on 2023-11-04 at 12:14:33. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
docs.ansible.com
various types exist, default = ini style but yaml is also possible
Many exist:
- ec2
- vmware
- foreman/satellite
- cobbler
...
- inventory is not a file but an executable (chmox +x) in any language, can be a binary
- executable must output (stdout) a specific json structure
- errors (stderr) are displayed as ansible errors
- inventory generator can happen remotely, the executable could just be a script that calls the remote inventory
- eg "curl -L https://webserver/inventory.py
- useful if inventory is generated from sensitive components you don't want to expose to the rest of the network
- no caching by ansible afaik; handle this in the executable itself
- eg generate a timestamped json file, output it to stdout, and only recreate the json if it's more than an hour old
- PROS: when done well, this method is very flexible; basically anything can be an inventory source for your script
- asset db's without plugins
- you can base groups on ANYTHING:
- in case of a DB query, create dynamic groups based on column values, and create special code for particular columns
- exclude non-ansible managable hosts,...
- a lot of work to get exactly right (invalid character names, missing attributes,... etc), dealing with data quality issues (typos in db, conversion to lowercase, ...)
See ansible docs, these have to be in python