# Reading a value from a file in the host\_vars folder

**URL:** <https://forum.ansible.com/t/reading-a-value-from-a-file-in-the-host-vars-folder/20980>\
**Category:** Ansible Project\
**Created:** [March 24, 2016, 2:29pm UTC](https://forum.ansible.com/t/reading-a-value-from-a-file-in-the-host-vars-folder/20980 "2016-03-24T14:29:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [March 24, 2016, 2:29pm UTC](https://forum.ansible.com/t/reading-a-value-from-a-file-in-the-host-vars-folder/20980/1 "2016-03-24T14:29:22Z")

</div>

Hi all,

is it possible to read a value from a file located in the host\_vars  
folder, if this is not the host the play should run on?

I am trying to convert a script creating a lxc container on host foo  
to an ansible playbook. But instead of calling the role with lots of  
variables (container name, user name, password, ...) I wanted to  
define them in the host\_vars file for the container, as I would need  
it a little later anyway.

Any hints?

Johannes

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [March 24, 2016, 2:34pm UTC](https://forum.ansible.com/t/reading-a-value-from-a-file-in-the-host-vars-folder/20980/2 "2016-03-24T14:34:33Z")

</div>

Reply to self...
