When I do a dump of hostvars I get a different result than when I dump hostvars[hostname]. Things like group_names, inventory_hostname and variables defined in the inventory are not shown in a dump of hostvars. Am I imagining things?
By ‘dump’ I mean a jinja2 template with the following code
{{ hostvars | to_nice_json }} - does not include group_names, inventory_name, etc
{{ hostvars[‘my_hostname’] | to_nice_json }} - does include group_names, etc
hostvars is not a variable, its an object that pretends to be variable
but lazily loads things, so only the 2nd form is guaranteed to have
all the vars.