# single role across all hosts but with different vars based on group

**URL:** <https://forum.ansible.com/t/single-role-across-all-hosts-but-with-different-vars-based-on-group/17682>\
**Category:** Ansible Project\
**Created:** [March 5, 2015, 7:23pm UTC](https://forum.ansible.com/t/single-role-across-all-hosts-but-with-different-vars-based-on-group/17682 "2015-03-05T19:23:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![david.neudorfer](https://avatars.discourse-cdn.com/v4/letter/d/b38774/32.png) [@david.neudorfer](https://forum.ansible.com/u/david.neudorfer)\
**Post date:** [March 5, 2015, 7:23pm UTC](https://forum.ansible.com/t/single-role-across-all-hosts-but-with-different-vars-based-on-group/17682/1 "2015-03-05T19:23:54Z")

</div>

Looking to speed up the runtime of our ansible playbook I’m looking to run a role called logstash-shipped across all hosts

- hosts: all  
roles:

- logstash-shipper

but load it with different vars depending on what group the host is in. Currently we have this split up into multiple tasks that run under each group but it would speed our build time significantly if we could run it only once.

example:

nginx group vars

log\_files:

- path: “/var/log/nginx/access.log”  
type: nginx-access
- path: “/var/log/nginx/error.log”  
type: nginx-error

application group vars

log\_files:

- path: “/var/log/app/\*\_console.log”  
type: app-console
- path: “/var/log/app/frontend\_admin.log”  
type: app-json
