Krikri::Inventory
Inventory - represents the complete inventory
Constructors
Instance methods
Real Ansible's host-pattern language: terms separated by : or
,, where a plain term is UNIONed, !term excludes and &term
intersects, applied left to right. Previously only a single term
was understood, so web:db, !web, prod:!db and web:&prod all
matched NOTHING - and, being a pattern that matches no hosts rather
than an error, the play was silently skipped.
Every group host_name belongs to, following :children upward, in
the sorted order real Ansible's group_names uses. Only "all" is
excluded (verified: a host in [web] under [prod:children] reports
exactly "prod, web").
"ungrouped" is NOT excluded, though it used to be: real Ansible
reports group_names == ["ungrouped"] for a host that belongs to
no other group, and that is genuine membership rather than an
internal artifact like "all" - a host listed above any [section]
header reported no groups at all here. Found in a regression sweep
while adding directory inventories (0.9.610). It only ever shows
up for a host with no real group, since any grouped host is not in
"ungrouped" to begin with.
Every host of name, following :children transitively - a parent
group's own hosts hash holds only hosts declared directly under
it, so a group defined purely as a parent ([prod:children])
otherwise resolved to nothing at all.
Public so the executor can build the groups magic var with the
same transitive view (a parent group's own hosts hash is empty).
Replaces this inventory's own hosts/groups with a freshly-parsed
inventory's data, in place - used by meta: refresh_inventory
(see TaskExecutor#execute_meta). Mutating in place, rather than
having the caller just swap in the new Inventory object wholesale,
is what lets a single shared instance (krikri-playbook.cr's own
inventory local plus every play's TaskExecutor @inventory, all
the SAME object) see the refresh without any callback/reference-
cell plumbing between the two - matches real Ansible's own
documented behavior, verified live: refreshing does NOT change
which hosts the CURRENT play iterates over (already fixed before
this runs), only what a LATER play's own hosts: pattern match
sees.