Ansible stores facts about machines under management by default and these can be accessed in playbooks and templates. To get a list of all the facts that are available about a machine, run a setup module as an ad-hoc action:
Ansible -m setup hostname
This will present all the facts that are available under that particular host.