On 18 February 2015 at 20:07, Brian Coca <[email protected]> wrote:
> In code the difference is mostly that hostvars is a 'cache' object
> that internally implements most (but not all, it seems) the methods of
> a dictionary. The default cache is an actual in memory dictionary but
> the object still acts as an intermediary.
>
Yes, that's what special about hostvars in the code. But as to what the
'hostvars' var is in ansible playbooks,
we're still missing the difference between two things in your assertion
here.
It sounds like something weird though.
There is probably a way to make it behave exactly the same in this
> case, but I would need to look into it deeper.
>
Given time I'll try to have a look myself. Perhaps this is part a thing
for -devel, as it seems to me
BTW, another example of how this is weird, just run these commands from an
empty dir:
serge@cyberlab:~/tmp$ ansible all -i localhost, -c local -m debug -a
> var=hostvars[inventory_hostname]
localhost | success >> {
> "hostvars[inventory_hostname]": {
> "group_names": [],
> "inventory_hostname": "localhost",
> "inventory_hostname_short": "localhost"
> }
> }
>
> serge@cyberlab:~/tmp$ ansible all -i localhost, -c local -m debug -a
> var=hostvars
> localhost | success >> {
> "hostvars": {
> "group_names": [],
> "inventory_hostname": "localhost",
> "inventory_hostname_short": "localhost"
> }
> }
>
Thanks,
Serge
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAEhzMJCSxr_K0LdZXiEr4m8RQU8iLKwTz-MZFwfq3SKMbjk1Kg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.