# Im generating a hosts file based on my inventory

**URL:** <https://forum.ansible.com/t/im-generating-a-hosts-file-based-on-my-inventory/34438>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [January 14, 2021, 3:52am UTC](https://forum.ansible.com/t/im-generating-a-hosts-file-based-on-my-inventory/34438 "2021-01-14T03:52:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [January 14, 2021, 3:52am UTC](https://forum.ansible.com/t/im-generating-a-hosts-file-based-on-my-inventory/34438/1 "2021-01-14T03:52:53Z")

</div>

Fix the template  
[https://gist.github.com/vbotka/31cdd229878a72780a72ea412252ab95](https://gist.github.com/vbotka/31cdd229878a72780a72ea412252ab95)

\* Expand the items one by one  
\* Take the first item of \*ansible\_all\_ipv4\_addresses\* (if this is what  
&nbsp;&nbsp;you want)
