# Insert hosts and host variables into a python script

**URL:** <https://forum.ansible.com/t/insert-hosts-and-host-variables-into-a-python-script/22158>\
**Category:** Ansible Project\
**Created:** [July 28, 2016, 11:14pm UTC](https://forum.ansible.com/t/insert-hosts-and-host-variables-into-a-python-script/22158 "2016-07-28T23:14:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dana\_Christo](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@Dana\_Christo](https://forum.ansible.com/u/Dana_Christo)\
**Post date:** [July 28, 2016, 11:14pm UTC](https://forum.ansible.com/t/insert-hosts-and-host-variables-into-a-python-script/22158/1 "2016-07-28T23:14:04Z")

</div>

Hello,

Is it possible to take a hostname and other information in the hosts file and insert each one into a python file as an ansible playbook runs the python file for each host?

---

<div class="post-metadata">

**Author:** ![Artyom\_Aleksandrov](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@Artyom\_Aleksandrov](https://forum.ansible.com/u/Artyom_Aleksandrov)\
**Post date:** [August 5, 2016, 9:32pm UTC](https://forum.ansible.com/t/insert-hosts-and-host-variables-into-a-python-script/22158/2 "2016-08-05T21:32:39Z")

</div>

Yes it possible.
