Get host name from inventory on remote host?

Was wondering if there's a way to get the hostname I've specified in
my inventory available as a var for use in a template on the remote
host? Would be useful for setting the hostname properly of a new
server that may have a different hostname defined in the setup
ansible_fqdn or ansible_hostname data... similar to the way
group_names are exposed in the setup data - maybe an
inventory_hostname?

We were discussing this on IRC today in fact, not presently, but it's going to be added.

I like inventory_hostname as a suggested name pretty well. I think we were thinking in terms of ansible_connectedname
though inventory_hostname makes better sense.

--Michael

+1 inventory_hostname

-sv

(realized I replied to author instead of reply)...

That's great news - will keep an eye out for it. Would consider
providing a patch but could use some brushing up on my Python
first...

Loving Ansible so far - coming from Puppet, this is much simpler and
just what I need... keep it up!

Good idea. I was using a hostname variable in my playbooks.

I'll take this one (it's a 3 line patch or so)!

Jeroen