#44 Simplify inventory scripts
Opened 6 years ago by cevich. Modified 6 years ago

According to the Ansible developer docs on this topic:

You only need to provide complete output for --host if you need v1.3 compatibility or don't provide _meta. Because the stated dependency here is for 2.2 (IIRC), all the inventory scripts can be greatly simplified as follows:

  • Behavior for --list remains unchanged.
  • If called with --host, simply return an empty (dictionary) JSON and exit.
  • For --list, add a guarantees that _meta is always included, even if it just has an empty hostvars mapping (end of the docs page).

stefw added a new comment to an issue you are following:
Do you have a patch for this?

I do not, and TBH I've only looked as far as standard-inventory-qcow2. Opened this issue as a point of discussion.

Should the pre. req. of standard-test-roles (Ansible 2.2+) invalidate any need lesser Ansible version's dyn. inv. API standards?

If so, should this be documented (here)?

Maybe there are others, but the main risk seems to be only in implementation (i.e. docs are lying, and --host must also be provided).

Login to comment on this ticket.

Metadata