# playbooks and hosts variables

**URL:** <https://forum.ansible.com/t/playbooks-and-hosts-variables/35111>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [May 4, 2021, 3:47pm UTC](https://forum.ansible.com/t/playbooks-and-hosts-variables/35111 "2021-05-04T15:47:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rene\_Paquin](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@Rene\_Paquin](https://forum.ansible.com/u/Rene_Paquin)\
**Post date:** [May 4, 2021, 3:47pm UTC](https://forum.ansible.com/t/playbooks-and-hosts-variables/35111/1 "2021-05-04T15:47:43Z")

</div>

I have a created a set of playbooks to deploy a server from a template in vmware. I have to admit this works great. The only changes I need to make are a few variables in a vars file and the hosts file. My question is in regarding the hosts file. Is it possible to use variables within the hosts file so that I only have to make changes in just my vars file or do I always have to modify the hosts file to add the ip address of the server for further configuration in some of the playbooks. I have tried a couple of things but unsuccessful.

Thanks,

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [May 4, 2021, 4:17pm UTC](https://forum.ansible.com/t/playbooks-and-hosts-variables/35111/2 "2021-05-04T16:17:47Z")

</div>

> I have a created a set of playbooks to deploy a server from a template in vmware. I have to admit this works great.  
> The only changes I need to make are a few variables in a vars file and the hosts file. My question is in regarding the  
> hosts file. Is it possible to use variables within the hosts file

so that I only have to make changes in just my vars

> file or do I always have to modify the hosts file to add the ip address

of the server for further configuration in some

> of the playbooks. I have tried a couple of things but unsuccessful.

Hello Rene,

which hosts file are you referring to?

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke
