This can be done by using the following command:
ansible -m debug -a "var=hostvars['hostname']" localhost