It is so simple to deploy hosts file that will contain DNS mapping between all your ansible managed nodes, this can be done via deploying Jinja2 template to location /etc/hosts, syntax of the Jinja2 is right below. localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
{% for host in groups['all'] %}
{{ hostvars[host].ansible_default_ipv4.address }} {{ hostvars[host].ansible_hostname }} {{ hostvars[host].ansible_nodename }}
{% endfor %}