# \--limit to run specific role for a host which is in multiple groups in inventory

**URL:** <https://forum.ansible.com/t/limit-to-run-specific-role-for-a-host-which-is-in-multiple-groups-in-inventory/26646>\
**Category:** Ansible Project\
**Created:** [February 2, 2018, 4:28pm UTC](https://forum.ansible.com/t/limit-to-run-specific-role-for-a-host-which-is-in-multiple-groups-in-inventory/26646 "2018-02-02T16:28:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajesh\_Ramachandran](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@Rajesh\_Ramachandran](https://forum.ansible.com/u/Rajesh_Ramachandran)\
**Post date:** [February 2, 2018, 4:28pm UTC](https://forum.ansible.com/t/limit-to-run-specific-role-for-a-host-which-is-in-multiple-groups-in-inventory/26646/1 "2018-02-02T16:28:42Z")

</div>

Hello,

I need to limit ansible to run specific role by limiting with groups in inventory. The inventory and role layouts listed below cannot be changed in our environment.

For example :

Inventory (all three groups have same server) :

[group1]  
server1

[group2]  
server1

[group3]  
server1

Playbook:

- hosts: group1  
roles: role1

- hosts: group2  
roles: role2

- hosts: group3  
roles: role3

When I run this :

ansible-playbook test.yml -i \<\> -t update\_config -C -K -l ‘group1’

This is running all the roles. I understand since the target is a single node and it is in all groups, it is by design to work like this. But is there are any workaround for this to limit running role to specific group. (Not by using specific tags again since we already have multiple tags within our roles)
