# Tasks per host same playbook.

**URL:** <https://forum.ansible.com/t/tasks-per-host-same-playbook/13445>\
**Category:** Ansible Project\
**Created:** [September 10, 2013, 11:25am UTC](https://forum.ansible.com/t/tasks-per-host-same-playbook/13445 "2013-09-10T11:25:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manuel\_Jimenez](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@Manuel\_Jimenez](https://forum.ansible.com/u/Manuel_Jimenez)\
**Post date:** [September 10, 2013, 11:25am UTC](https://forum.ansible.com/t/tasks-per-host-same-playbook/13445/1 "2013-09-10T11:25:10Z")

</div>

Hello,

I have 3 differents servers with nginx. Each one has its own vhost with custom configuration. But all 3 servers uses the same piece of configuration in one section of the vhost.

My question is, im trying to do the following thing in the same playbook.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [September 10, 2013, 12:34pm UTC](https://forum.ansible.com/t/tasks-per-host-same-playbook/13445/2 "2013-09-10T12:34:52Z")

</div>

You should look into roles and using a common role between hosts.

Roles can also pass parameters to them.

---

<div class="post-metadata">

**Author:** ![Manuel\_Jimenez](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@Manuel\_Jimenez](https://forum.ansible.com/u/Manuel_Jimenez)\
**Post date:** [September 11, 2013, 11:14am UTC](https://forum.ansible.com/t/tasks-per-host-same-playbook/13445/3 "2013-09-11T11:14:56Z")

</div>

I don’t see how to using roles I can solve my “problem”. I’ll try to write down a detailed example.

I have a var file in which I fill with new infomation daily, this information should be included in a section of the vhost of 3 differents nginx servers. Every nginx server has his own configuration, but one section in every vhost has the daily information that I fill, so I need to using the “template” function to populate the vhost and then populate with a “for” in the template with this info.

Daily I need to add new info to the vhost, like rolling update, but not apply all roles or playbooks to the server, only update vhost and reload nginx.

Playbook for rolling update:  
update\_IP.yml

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [September 11, 2013, 12:20pm UTC](https://forum.ansible.com/t/tasks-per-host-same-playbook/13445/4 "2013-09-11T12:20:47Z")

</div>

If you make a common role and include it for all hosts you can set variables there.

You don’t even need to set any tasks.
