# Is there a simple way to find host groups for a role?

**URL:** <https://forum.ansible.com/t/is-there-a-simple-way-to-find-host-groups-for-a-role/18958>\
**Category:** Ansible Project\
**Created:** [August 5, 2015, 11:47pm UTC](https://forum.ansible.com/t/is-there-a-simple-way-to-find-host-groups-for-a-role/18958 "2015-08-05T23:47:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sergey\_Maslyakov](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@Sergey\_Maslyakov](https://forum.ansible.com/u/Sergey_Maslyakov)\
**Post date:** [August 5, 2015, 11:47pm UTC](https://forum.ansible.com/t/is-there-a-simple-way-to-find-host-groups-for-a-role/18958/1 "2015-08-05T23:47:36Z")

</div>

Given an Ansible playbook, is there a simple way to list out all host groups that a given roles belongs to?

My roles install applications using RPMs. If there is a fix in an application, I need to know what servers I should update.

Thank you,  
/Sergey

---

<div class="post-metadata">

**Author:** ![Greg\_DeKoenigsberg1](https://avatars.discourse-cdn.com/v4/letter/g/838e76/32.png) [@Greg\_DeKoenigsberg1](https://forum.ansible.com/u/Greg_DeKoenigsberg1)\
**Post date:** [August 6, 2015, 3:04pm UTC](https://forum.ansible.com/t/is-there-a-simple-way-to-find-host-groups-for-a-role/18958/2 "2015-08-06T15:04:10Z")

</div>

–list-hosts option is what you want.

---

<div class="post-metadata">

**Author:** ![Greg\_Kedge](https://avatars.discourse-cdn.com/v4/letter/g/3e96dc/32.png) [@Greg\_Kedge](https://forum.ansible.com/u/Greg_Kedge)\
**Post date:** [November 8, 2015, 5:08pm UTC](https://forum.ansible.com/t/is-there-a-simple-way-to-find-host-groups-for-a-role/18958/3 "2015-11-08T17:08:21Z")

</div>

It isn’t I am not seeing --limit working conjunction with --list-hosts 2.0.beta as it did in 1.9. I was search through here is to see if others were making the same observation.

E.g.: This provides all hosts in an inventory without the requested limit:

```auto
ansible -i inventory --limit [group|host] --list-hosts all

```

If limiting is of interest, --list-hosts had and continues to exhibit limiting behavior. Just now, it is the required way to limit.

```auto
ansible -i inventory --list-hosts [group|host]

```

This is a much more succinct, but may break existing expectations.
