hostvars[some_ip] does not contain `ansible_hostname`

16 views
Skip to first unread message

Barry Kaplan

unread,
Nov 3, 2018, 4:15:23 PM11/3/18
to Ansible Project
Why would this be? It has lots and lots of ansible_* variables, but some others like ansible_hostname or ansible_mounts.

This is not the case for hosts though, just some.

Uwe Sauter

unread,
Nov 3, 2018, 4:20:21 PM11/3/18
to ansible...@googlegroups.com
In order to access some ansible_* variables you need to gather facts on the host before.

See e.g. https://stackoverflow.com/questions/45908067/whats-the-difference-between-inventory-hostname-and-ansible-hostname

Am 03.11.18 um 21:15 schrieb Barry Kaplan:
> Why would this be? It has lots and lots of ansible_* variables, but some others like ansible_hostname or ansible_mounts.
>
> This is not the case for hosts though, just some.
>
> --
> 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
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To post to this group, send email to ansible...@googlegroups.com <mailto:ansible...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/93639896-f6e0-413b-bb24-e74f7413c0aa%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/93639896-f6e0-413b-bb24-e74f7413c0aa%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages