All I could find was this from the docs:
Additionally,
inventory_hostname
is the name of the hostname as configured in Ansible’s inventory host file. This can be useful for when you don’t want to rely on the discovered hostnameansible_hostname
or for other mysterious reasons. If you have a long FQDN,inventory_hostname_short
also contains the part up to the first period, without the rest of the domain.
Is there any actual difference between inventory_hostname
and ansible_hostname
variables in Ansible? If so, then which one should I use and when?